Part Number Hot Search : 
STD350 PNZ155 2N1717 SA5624 QY212 150CT TESN75A 525CZ
Product Description
Full Text Search
 

To Download S3P9234 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  2 1 - s3 - c9234/p9234-022004 user's manual s3c9234/p9234 8 -bit cmos microcontroller revision 1.0
s3c9234/p9234 product overview 1- 1 1 product overview sam8 8rc ri product family samsung's sam88rcri family of 8-bit single-chi p cmos microcontrollers offer fast and efficient cpu, a wide range of integrated peripherals, and supports otp device . a dual address/data bus architecture and bit- or nibble-configurable i/o ports provide a flexible programming environment for applications with varied memory and i/o requirements. timer/counters with selectable operating modes are included t o support real-time operations. s3c9234/p9234 microcontroller the s3c9234 can be used for dedicated control functions in a variety of applications, and is especially designed for application with frs or etc. the s3c9234/p9234 single-chip 8-bit microcontroller is fabricated using an advanced cmos process. it is built around the powerful sam88rcri cpu core. stop and idle power-down modes were implemented to reduce power consumption. to increase on-chip register space, the size of the internal register file was logically expanded. the s3c9234/p9234 has 4k-byte of program rom, and 208-byte of ram (including 16-byte of working register and 16-byte lcd display ram). using the sam 88rcri design approach, the following peripherals were integrated with the sam88rcri core: ? 7 configurable i/o ports including ports shared with segment/common drive outputs ? 7-bit programmable pins for external interrupts ? one 8-bit basic timer for oscillation stabilization and watch-dog functions ? two 8-bit timer/counters with selectable operating modes ? watch timer for real time ? 8-bit serial i/o interface otp the s3c9234 microcontroller is also available in otp (one time programmable) version. S3P9234 microcontroller has an on-chip 4k-byte one-time-programmable eprom instead of masked rom. the S3P9234 is comparable to s3c9234, both in function and in pin configuration.
product overview s3c9234/p9234 1- 2 features cpu sam88rcri cpu core memory 4k 8 bits program memory (rom) 208 8 bits data memory (ram) (including lcd data memory) instruction set 41 instructions idle and stop instructions added for power-down modes 52 i/o pins i/o: 16 pins i/o: 36 pins (sharing with lcd signal outputs) interrupts 11 interrupt source and 1 vector one interrupt level 8-bit basic timer watchdog timer function 3 kinds of clock source two 8-bit timer/counters the programmable 8-bit timer/counters external event counter function configurable as one 16-bit timer/counters watch timer interval time: 3.91ms, 0.25s, 0.5s, and 1s at 32.768 khz 0.5/1/2/4 khz selectable buzzer output lcd controller/driver 32 segments and 4 common terminals static, 1/2 duty, 1/3 duty, and 1/4 duty selectable internal resistor circuit for lcd bias 8-bit serial i/o interface 8-bit transmit/receive mode 8-bit receive mode lsb-first or msb-first transmission selectable internal or external clock source two power-down modes idle mode: only cpu clock stops stop mode: system clock and cpu clock stop oscillation sources crystal, ceramic, or rc for main clock main clock frequency: 0.4 mhz - 8mhz 32.768 khz crystal oscillation circuit for sub clock instruction execution times 500ns at 8mhz fx(minimum) operating voltage range 2.0 v to 5.5 v at 0.4 - 4.2mhz 2.7 v to 5.5 v at 0.4 - 8.0mhz operating temperature range -25 c to +85 c package type 64-pin qfp
s3c9234/p9234 product overview 1- 3 block diagram 8-bit timer/ countera port i/o and interrupt control sam88rcri cpu reset x in xt in i/o port 0 4-kbyte rom 208-byte register file x out xt out 16-bit timer/ counter1 8-bit timer/ counterb p0.0-p0.3/ com0-com3 i/o port 1 p2.0/sck p2.1/so p2.2/si p2.3 p2.4/int p2.5/int p2.6/int p2.7/int i/o port 2 i/o port 3 i/o port 4 p4.0-p4.7/ seg23-seg16 watchdog timer basic timer watch timer lcd driver/ controller sio i/o port 6 p2.0/sck p2.1/so p2.2/si buz/p1.7 i/o port 5 taout/p1.4 t1clk/p1.3 tbout/p1.5 p3.0-p3.7/ seg31-seg24 p1.0/int p1.1/int p1.2/int p1.3/t1clk p1.4/taout p1.5/tbout p1.6/clkout p1.7/buz seg24-seg31/p3.7-p3.0 seg16-seg23/p4.7-p4.0 seg8-seg15/p5.7-p5.0 com0-com3/p0.0-p0.3 seg0-seg7/p6.7-p6.0 p6.0-p6.7/ seg7-seg0 p5.0-p5.7/ seg15-seg8 figure 1-1. block diagram
product overview s3c9234/p9234 1- 4 pin assignments s3c9234(S3P9234) (64-qfp-1420f) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 64 63 62 61 60 59 58 57 56 55 54 53 52 20 21 22 23 24 25 26 27 28 29 30 31 32 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 seg13/p5.2 seg14/p5.1 seg15/p5.0 seg16/p4.7 seg17/p4.6 seg18/p4.5 seg19/p4.4 seg20/p4.3 seg21/p4.2 seg22/p4.1 seg23/p4.0 seg24/p3.7 seg25/p3.6 seg26/p3.5 seg27/p3.4 seg28/p3.3 seg29/p3.2 seg30/p3.1 seg31/p3.0 com0/p0.0 com1/p0.1 com2/p0.2 com3/p0.3 bias vlc0 vlc1 vlc2 v dd v ss x out x in test xt in xt out reset p1.0/int p1.1/int p1.2/int seg0/p6.7 seg1/p6.6 seg2/p6.5 seg3/p6.4 seg4/p6.3 seg5/p6.2 seg6/p6.1 seg7/p6.0 seg8/p5.7 seg9/p5.6 seg10/p5.5 seg11/p5.4 seg12/p5.3 p1.3/t1clk p1.4/taout p1.5/tbout p1.6/clkout p1.7/buz p2.0/sck p2.1/so p2.2/si p2.3 p2.4/int p2.5/int p2.6/int p2.7/int figure 1-2. s3c9234 64-qfp pin assignments
s3c9234/p9234 product overview 1- 5 pin descriptions table 1- 1 . pin descriptions pin names pin type pin description circuit type pin no. share d functions p0.0 - p0.3 i/o i/o port with bit-programmable pins; input or push-pull output and software assignable pull-ups. h-9 1 - 4 com0-com3 p1.0 - p1.2 p1.3 p1.4 p1.5 p1.6 p1.7 i/o i/o port with bit-programmable pins; schmitt trigger input or push-pull, open-drain output and software assignable pull-ups; p1.0 ? p1.2 are alternately used for external interrupt input(noise filters, interrupt enable and pending control). e-4 17 ? 19 20 21 22 23 24 int t1clk taout tbout clkout buz p2.0 p2.1 p2.2 p2.3 p2.4 ? p2.7 i/o i/o port with bit-programmable pins; schmitt trigger input or push-pull, open-drain output and software assignable pull-ups. e-4 25 26 27 28 29 - 32 sck so si - int p3.0 - p3.7 i/o i/o port with bit-programmable pins; input or push-pull, open-drain output and software assignable pull-ups. h-8 33 - 40 seg31-seg24 p4.0 - p4.7 i/o i/o port with bit-programmable pins; input or push-pull output and software assignable pull-ups. h-9 41 - 48 seg23-seg16 p5.0 ? p5.7 i/o i/o port with bit-programmable pins; input or push-pull output and software assignable pull-ups. h-9 49 - 56 seg15-seg8 p6.0 ? p6.7 i/o i/o port with 2bits-programmable pins; input or push-pull output and software assignable pull-ups. h-9 57 - 64 seg7-seg0 reset i system reset pin b 16 ? xt in ,xt out ? crystal oscillator pins for sub clock. ? 14, 15 ? x in ,x out ? main oscillator pins. ? 12, 11 ? test i test input: it must be connected to v ss ? 13 ? v dd ,v ss ? power input pins ? 9, 10 ? bais ? lcd power control pin ? 5 ? vlc0?vlc2 ? lcd power supply pin ? 6 ? 8 ? int i/o external interrupts input pins. e-4 17 ? 19 29 ? 32 p1.0 ? p1.2 p2.4 ? p2.7
product overview s3c9234/p9234 1- 6 table 1- 1 . pin descriptions (continued) pin names pin type pin description circuit type pin no. share d functions t1clk i/o timer 1/a external clock input. e-4 20 p1.3 taout i/o timer 1/a clock output. e-4 21 p1.4 tbout i/o timer b clock output. e-4 22 p1.5 clkout i/o system clock output. e-4 23 p1.6 buz i/o output pin for buzzer signal. e-4 24 p1.7 sck, so, si i/o serial clock, serial data output, and serial data input. e-4 25 ? 27 p2.0 ? p2.2 com0-com3 i/o lcd common signal outputs. h-9 1 ? 4 p0.0 ? p0.3 seg0 ? seg7 seg8 ? seg15 seg16 ? seg23 i/o lcd segment signal outputs. h-9 64 ? 57 56 ? 49 48 ? 41 p6.7 ? p6.0 p5.7 ? p5.0 p4.7 ? p4.0 seg24 ? seg31 i/o lcd segment signal outputs. h-8 40 ? 33 p3.7 ? p3.0
s3c9234/p9234 product overview 1- 7 pin circuit diagrams in v dd p-channel n-channel figure 1-3. pin circuit type a in v dd pull-up resistor noise filter schmitt trigger figure 1-4. pin circuit type b v dd resistor enable v dd i/o pull-up resistor output disable data open-drain p-ch n-ch figure 1-5. pin circuit type e-4 (p1, p2)
product overview s3c9234/p9234 1- 8 n-ch v dd resistor enable v dd i/o pull-up resistor p-ch data open-drain circuit type h-4 seg output disable 2 output disable 1 figure 1-6. pin circuit type h-8 (p3) n-ch v dd resistor enable v dd i/o pull-up resistor p-ch data circuit type h-4 com/seg output disable 2 output disable 1 figure 1-7. pin circuit type h-9 (p0, p4, p5, p6)
s3c9234/p9234 product overview 1- 9 out v ss v lc2 com/seg v lc0 v lc1 output disable figure 1-8. pin circuit type h-4
product overview s3c9234/p9234 1- 10 notes
s3c9234/p9234 address spaces 2- 1 2 address spaces overview the s3c9234/p9234 microcontroller has three kinds of address space: ? program memory (rom) ? internal register file ? lcd display register file a 16 -bit address bus supports program memory operations. special instructions and related internal logic determine when the 1 6 -bit bus carries addresses for program memory. a separate 8 -bit register bus carries addresses and data between the cpu and the internal register file. the s3c9234 has 4k bytes of mask - programmable program memory on-chip . the s3c9234/p9234 microcontroller has 192 bytes general-purpose registers in its internal register file and the 16 bytes for lcd display memory is implemented in the internal register file too. 48 bytes in the register file are mapped for system and peripheral control functions.
address spaces s3c9234/p9234 2- 2 program memory (rom) program memory (rom) stores program code or table data. the S3P9234 has 4k bytes of mask - programmable program memory. the program memory address range is therefore 0h-0fffh. the first 2 bytes of the rom (0000h? 0001h) are an interrupt vector address. the program reset address in the rom is 0100h. 4,096 256 0fffh 0100h 0 4k bytes internal program memory area interrupt vector 1 2 0002h 0001h program start 0000h (decimal) (hex) figure 2- 1. s3c9234/p9234 program memory address space
s3c9234/p9234 address spaces 2- 3 register architecture the upper 64 bytes of the s3c9234/p9234 's internal register file are addressed as working registers, system cont r ol registe r s and periphe r al control registers. the lower 192 bytes of internal register file (00h? bf h) is called the general purpose register space . for many sam88rcri microcontrollers, the addressable area of the internal register file is further expanded by the additional of one or more register pages at general purpose register space (00h?bfh). ffh b0h ~ afh 00h 192 bytes 64 bytes of common area d0h cfh e0h dfh working registers system control registers peripheral control registers general purpose register file and stack area lcd display registers and general purpose registers c0h bfh byte figure 2- 2 . internal register file organization
address spaces s3c9234/p9234 2- 4 common working register area (c0h?cfh) the sam88rcr i register architecture provides an efficient method of working register addressing that takes full advantage of shorter instruction formats to reduce execution time. this16-byte address range is called common area. that is, locations in this area can be used as working registers by operations that address any location on any page in the register file. typically, these working registers serve as temporary buffers for data operations between different pages. the register (r) addressing mode can be used to access this area registers are addressed either as a single 8-bit register or as a paired 16-bit register. in 16-bit register pairs, the address of the first 8-bit register is always an even number and the address of the next register is an odd number. the most significant byte of the 16-bit data is always stored in the even-numbered register; the least significant byte is always stored in the next (+ 1) odd-numbered register. msb rn lsb rn + 1 n = even address figure 2- 3 . 16-bit register pairs f programming tip ? addressing the common working register area as the following examples show, you should access working registers in the common area, locations c0h?cfh, using working register addressing mode only. example s: 1. ld 0c2h,40h ; invalid addressing mode! use working register addressing instead: ld r2,40h ; r2 (c2h) ? the value in location 40h 2. add 0c3h,#45h ; invalid addressing mode! use working register addressing instead: add r3,#45h ; r3 (c3h) ? r3 + 45h
s3c9234/p9234 address spaces 2- 5 system stack s 3c9 -series microcontrollers use the system stack for subroutine calls and returns and to store data. the push and pop instructions are used to control system stack operations. the s3c9234/p9234 architecture supports stack operations in the internal register file. stack operations return addresses for procedure calls and interrupts and data are stored on the stack. the contents of the pc are saved to stack by a call instruction and restored by the ret instruction. when an interrupt occurs, the contents of the pc and the flags register are pushed to the stack. the iret instruction then pops these values back to their original locations. the stack address is always decremented before a push operation and incremented after a pop operation. the stack pointer (sp) always points to the stack frame stored on the top of the stack, as shown in figure 2-4 . stack contents after a call instruction stack contents after an interrupt top of stack flags pch pcl pcl pch top of stack low address high address figure 2- 4 . stack operations stack pointer (sp) register location d9h contains the 8-bit stack pointer (sp) that is used for system stack operations. after a reset, the sp value is undetermined. because only internal memory space is implemented in the s3c9234/p9234 , the sp must be initialized to an 8-bit value in the range 00h? af h. note in case a stack pointer is initialized to 00h, it is decrea s ed to ffh when stack operation starts. this means that a stack pointer access invalid stack area.
address spaces s3c9234/p9234 2- 6 f programming tip ? standard stack operations using push and pop the following example shows you how to perform stack operations in the internal register file using push and pop instructions: ld sp,#0 b8 h ; sp ? b8 h (normally, the sp is set to 0 b8 h by the ; initialization routine) ? ? ? push sym ; stack address 0b 7 h ? sym push wt con ; stack address 0b 6 h ? wt con push 20h ; stack address 0b 5 h ? 20h push r3 ; stack address 0b 4 h ? r3 ? ? ? pop r3 ; r3 ? stack address 0b 4 h pop 20h ; 20h ? stack address 0b 5 h pop wt con ; wt con ? stack address 0b 6 h pop sym ; sym ? stack address 0b 7 h
s3c9234/p9234 addressing modes 3- 1 3 addressing modes overview instructions that are stored in program memory are fetched for execution using the program counter. instructions indicate the operation to be performed and the data to be operated on. addressing mode is the method used to determine the location of the data operand. the operands specified in sam88rc r i instructions may be condition codes, immediate data, or a location in the register file, program memory, or data memory. the sam88rcri instruction set supports six explicit addressing modes. not all of these addressing modes are available for each instruction. the addressing modes and their symbols are as follows: ? register (r) ? indirect register (ir) ? indexed (x) ? direct addr ess (da) ? relative address (ra) ? immediate (im)
addressing modes s3c9234/p9234 3- 2 register addressing mode (r) in register addressing mode, the operand is the content of a specified register (see figure 3- 1). working register addressing differs from register a ddressing because it uses a 16- byte working register s pace in the register file and a 4-bit register within that space (see figure 3- 2). dst value used in instruction execution opcode operand 8-bit register file address point to one rigister in register file one-operand instruction (example) sample instruction: dec cntr ; where cntr is the label of an 8-bit register address program memory register file figure 3- 1 . register addressing dst opcode 4-bit working register point to the woking register (1 of 16) two-operand instruction (example) sample instruction: add r1, r2 ; where r1 = c1h and r2 = c2h program memory register file src 4 lsbs operand cfh c0h . . . . figure 3- 2 . working register addressing
s3c9234/p9234 addressing modes 3- 3 indirect register addressing mode (ir) in indirect register (ir) addressing mode, the content of the specified register or register pair is the address of the operand. depending on the instruction used, the actual address may point to a register in the register file, to program memory (rom), or to an external memory space (see figures 3- 3 through 3- 6). you can use any 8-bit register to indirectly address another register. any 16-bit register pair can be used to indirectly address another memory location. 8-bit register file address one-operand instruction (example) dst address of operand used by instruction opcode address point to one rigister in register file sample instruction: rl @shift ; where shift is the label of an 8-bit register address program memory register file value used in instruction execution operand figure 3- 3 . indirect register addressing to register file
addressing modes s3c9234/p9234 3- 4 indirect register addressing mode ( c ontinued ) dst opcode pair points to rigister pair example instruction references program memory sample instructions: call @rr2 jp @rr2 program memory register file value used in instruction operand register program memory 16-bit address points to program memory figure 3- 4 . indirect register addressing to program memory
s3c9234/p9234 addressing modes 3- 5 indirect register addressing mode (c ontinued ) dst opcode operand 4-bit working register address point to the woking register (1 of 16) sample instruction: or r6, @r2 program memory register file src 4 lsbs value used in instruction operand cfh c0h . . . . figure 3- 5 . indirect working register addressing to register file
addressing modes s3c9234/p9234 3- 6 indirect register addressing mode (c oncluded ) dst opcode 4-bit working register address sample instructions: lcd r5,@rr6 ; program memory access lde r3,@rr14 ; external data memory access lde @rr4, r8 ; external data memory access program memory register file src value used in instruction operand example instruction references either program memory or data memory program memory or data memory next 3 bits point to working register pair (1 of 8) lsb selects register pair 16-bit address points to program memory or data memory cfh . . . . c0h figure 3- 6 . indirect working register addressing to program or data memory
s3c9234/p9234 addressing modes 3- 7 indexed addressing mode (x) indexed (x) addressing mode adds an offset value to a base address during instruction execution in order to calculate the effective operand address (see figure 3- 7). you can use indexed addressing mode to access locations in the internal register file or in external memory. in short offset indexed addressing mode, the 8- bit displacement is treated as a signed integer in the range of ?128 to +127. this applies to external memory accesses only (see figure 3- 8). for register file addressing, an 8-b it base address provided by the instruction is added to an 8-bit offset contained in a working register. for external memory accesses, the base address is stored in the working register pair designated in the instruction. the 8-bit or 16-bit offset given in the instruction is then added to the base address (see figure 3- 9). the only instruction that supports indexed addressing mode for the internal register file is the load instruction (ld). the ldc and lde instructions support indexed addressing mode for internal program memory, external program memory, and for external data memory, when implemented. dst opcode two-operand instruction example point to one of the woking register (1 of 16) sample instruction: ld r0, #base[r1] ; where base is an 8-bit immediate value program memory register file 4 lsbs value used in instruction operand index base address ~ ~ ~ ~ + src figure 3- 7 . indexed addressing to register file
addressing modes s3c9234/p9234 3- 8 indexed addressing mode (c ontinued ) point to working register pair (1 of 8) lsb selects 16-bit address added to offset dst opcode program memory xs (offset) 4-bit working register address sample instructions: ldc r4, #04h[rr2] ; the values in the program address (rr2 + #04h) are loaded into register r4. lde r4,#04h[rr2] ; identical operation to ldc example, except that external program memory is accessed. next 3 bits register pair src 8-bits 16-bits + program memory or data memory operand value used in instruction 16-bits register file figure 3- 8 . indexed addressing to program or data memory with short offset
s3c9234/p9234 addressing modes 3- 9 indexed addressing mode (c oncluded ) point to working register pair (1 of 8) lsb selects 16-bit address added to offset program memory 4-bit working register address sample instructions: ldc r4, #1000h[rr2] ; the values in the program address (rr2 + #1000h) are loaded into register r4. lde r4, #1000h[rr2] ; identical operation to ldc example, except that external program memory is accessed. next 3 bits register pair 8-bits 16-bits + program memory or data memory operand value used in instruction 16-bits register file opcode xl h (offset) xl l (offset) dst src figure 3- 9 . indexed addressing to program or data memory with long offset
addressing modes s3c9234/p9234 3- 10 direct address mode (da) in direct address (da) mode, the instruction provides the operand's 16-bit memory address. jump (jp) and call (call) instructions use this addressing mode to specify the 16-bit destination address that is loaded into the pc whenever a jp or call instruction is executed. the ldc and lde instructions can use direct address mode to specify the source or destination address for load operations to program memory (ldc) or to external data memory (lde), if implemented. sample instructions: ldc r5,1234h ; the values in the program address (1234h) are loaded into register r5. lde r5,1234h ; identical operation to ldc example, except that external program memory is accessed. dst/src opcode program memory "0" or "1" lower address byte lsb selects program memory or data memory: "0" = program memory "1" = data memory memory address used upper address byte program or data memory figure 3- 10 . direct addressing for load instructions
s3c9234/p9234 addressing modes 3- 11 direct address mode (c ontinued ) opcode program memory upper address byte program memory address used lower address byte sample instructions: jp c,job1 ; where job1 is a 16-bit immediate address call display ; where display is a 16-bit immediate address next opcode figure 3- 11 . direct addressing for call and jump instructions
addressing modes s3c9234/p9234 3- 12 relative address mode (ra) in relative address (ra) mode, a two's-complement signed displacement between ? 128 and + 127 is specified in the instruction. the displacement value is then added to the current pc value. the result is the address of the next instruction to be executed. before this addition occurs, the pc contains the address of the instruction immediately following the current instruction. the instructions that support ra addressing is jr. opcode program memory displacement program memory address used sample instructions: jr ult,$ + offset ; where offset is a value in the range + 127 to - 128 next opcode + signed displacement value current instruction current pc value figure 3- 12 . relative addressing immediate mode (im) in immediate (im) addressing mode, the operand value used in the instruction is the value supplied in the operand field itself. immediate addressing mode is useful for loading constant values into registers. (the operand value is in the instruction) opcode sample instruction: ld r0,#0aah program memory operand figure 3- 13 . immediate addressing
s3c9234/p9234 control registers 4- 1 4 control registers overview in this section, detailed descriptions of the s3c9234/p9234 control registers are presented in an easy-to-read format. these descriptions will help familiarize you with the mapped locations in the register file. you can also use them as a quick-reference source when writing application programs. system and peripheral registers are summarized in table 4- 1. figure 4- 1 illustrates the important features of the standard register description format. control register descriptions are arranged in alphabetical order according to register mnemonic. more information about control registers is presented in the context of the various peripheral hardware descriptions in part ii of this manual.
control registers s3c9234/p9234 4- 2 table 4-1. sys tem and peripheral c ontrol registers register name mnemonic address(page 0) r/w reset value(bit) decimal hex 7 6 5 4 3 2 1 0 sio control register siocon 208 d0h r/w 0 0 0 0 0 0 0 0 sio data register siodata 209 d1h r/w 0 0 0 0 0 0 0 0 sio prescaler register siops 210 d2h r/w 0 0 0 0 0 0 0 0 oscillator control register osccon 211 d3h r/w ? ? ? ? 0 0 ? 0 system clock control register clkcon 212 d4h r/w 0 0 0 0 0 0 0 0 system flags register flags 213 d5h r/w x x x x ? ? ? ? stop control register stpcon 214 d6h r/w 0 0 0 0 0 0 0 0 lcd control register lcon 215 d7h r/w 0 0 0 0 0 0 ? 0 interrupt pending register intpnd 216 d8h r/w 0 0 0 0 ? 0 0 0 stack pointer sp 217 d9h r/w x x x x x x x x watch timer control register wtcon 218 dah r/w 0 0 0 0 0 0 0 0 location dbh is not mapped. basic timer control register btcon 220 dch r/w 0 0 0 0 0 0 0 0 basic timer counter btcnt 221 ddh r x x x x x x x x location deh is not mapped. system mode register sym 223 dfh r/w x x x x 0 0 0 0 port 0 data register p0 224 e0h r/w 0 0 0 0 0 0 0 0 port 1 data register p1 225 e1h r/w 0 0 0 0 0 0 0 0 port 2 data register p2 226 e2h r/w 0 0 0 0 0 0 0 0 port 3 data register p3 227 e3h r/w 0 0 0 0 0 0 0 0 port 4 data register p4 228 e4h r/w 0 0 0 0 0 0 0 0 port 5 data register p5 229 e5h r/w 0 0 0 0 0 0 0 0 port 6 data register p6 230 e6h r/w 0 0 0 0 0 0 0 0 timer a counter tacnt 231 e7h r 0 0 0 0 0 0 0 0 timer b counter tbcnt 232 e8h r 0 0 0 0 0 0 0 0 timer a data register tadata 233 e9h r/w 1 1 1 1 1 1 1 1 timer b data register tbdata 234 eah r/w 1 1 1 1 1 1 1 1 timer 1/a control register tacon 235 ebh r/w 0 0 0 0 0 0 0 0 timer b control register tbcon 236 ech r/w ? 0 0 0 0 0 0 0
s3c9234/p9234 control registers 4- 3 table 4- 1. sys tem and peripheral c ontrol registers (continued) register name mnemonic address(page 0) r/w reset value(bit) decimal hex 7 6 5 4 3 2 1 0 port 0 control register p0con 237 edh r/w 0 0 0 0 0 0 0 0 port 1 control register(high byte) p1conh 238 eeh r/w 0 0 0 0 0 0 0 0 port 1 control register(low byte) p1conl 239 efh r/w 0 0 0 0 0 0 0 0 port 1 pull-up resistor enable register p1pur 240 f0h r/w 0 0 0 0 0 0 0 0 port 1 interrupt control register p1int 241 f1h r/w ? ? 0 0 0 0 0 0 port 2 control register (high byte) p2conh 242 f2h r/w 0 0 0 0 0 0 0 0 port 2 control register (low byte) p2conl 243 f3h r/w 0 0 0 0 0 0 0 0 port 2 pull-up resistor enable register p2pur 244 f4h r/w 0 0 0 0 0 0 0 0 port 2 interrupt control register p2int 245 f5h r/w 0 0 0 0 0 0 0 0 port 3 control register (high byte) p3conh 246 f6h r/w 0 0 0 0 0 0 0 0 port 3 control register (low byte) p3conl 247 f7h r/w 0 0 0 0 0 0 0 0 port 3 pull-up resistor enable register p3pur 248 f8h r/w 0 0 0 0 0 0 0 0 port 4 control register (high byte) p4conh 249 f9h r/w 0 0 0 0 0 0 0 0 port 4 control register (low byte) p4conl 250 fah r/w 0 0 0 0 0 0 0 0 port 5 control register (high byte) p5conh 251 fbh r/w 0 0 0 0 0 0 0 0 port 5 control register (low byte) p5conl 252 fch r/w 0 0 0 0 0 0 0 0 port 6 control register p6con 253 fdh r/w 0 0 0 0 0 0 0 0 clock output control register clocon 254 feh r/w ? ? ? ? ? ? 0 0 location ffh is not mapped. notes: 1. an "x" means that the bit value is undefined following reset. 2. a dash("-") means that the bit is neither used nor mapped, but the bit is read as "0".
control registers s3c9234/p9234 4- 4 flags - system flags register .7 .6 .5 bit identifier reset value read/write r = read-only w = write-only r/w = read/write ' - ' = not used bit number: msb = bit 7 lsb = bit 0 addressing mode or modes you can use to modify register values (1-bit, 4-bit, or 8-bit) description of the effect of specific bit settings reset value notation: '-' = not used 'x' = undetermind value '0' = logic zero '1' = logic one bit number(s) that is/are appended to the register name for bit addressing d5h register address (hexadecimal) full register name register mnemonic name of individual bit or bit function .7 .6 .5 .4 .2 .3 .1 .0 x r/w x r/w x r/w x r/w 0 r/w x r/w 0 r/w x r/w carry flag (c) 0 operation dose not generate a carry or borrow condition 1 operation generates carry-out or borrow into high-order bit7 zero flag 0 operation result is a non-zero value 1 operation result is zero sign flag 0 operation generates positive number (msb = "0") 1 operation generates negative number (msb = "1") figure 4-1. register description format
s3c9234/p9234 control registers 4- 5 btc on ? basic timer co ntrol register dch bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7- .4 watchdog timer function disable code (for system reset) 1 0 1 0 disable watchdog timer function any other value enable watchdog timer function .3- .2 basic timer clock selection bits 0 0 f xx /4096 0 1 f xx /1024 1 0 f xx /128 1 1 fxx/16 .1 basic timer counter clear bit 0 no effect 1 clear the basic timer counter value (automatically cleared to "0" after being cleared basic timer counter) .0 clock frequency divider clear bit for basic timer and timer counters 0 no effect 1 clear clock frequency dividers (automatically cleared to "0" after being cleared clock frequency dividers) note : the fxx is the selected clock for system (main clock or sub clock).
control registers s3c9234/p9234 4- 6 clkcon ? system clock control register d4h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 oscillator irq wake-up function enable bit 0 enable irq for main oscillator wake-up function 1 disable irq for main oscillator wake-up function . 6-.5 bits 6-5 0 always logic zero .4- .3 cpu clock (system clock) frequency selection bits 0 0 select fxx/16 0 1 select fxx/8 1 0 select fxx/2 1 1 non-divided clock ( fxx ) . 2-.0 bits 2-0 0 always logic zero
s3c9234/p9234 control registers 4- 7 cl ocon ? clock output control register fe h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value ? ? ? ? ? ? 0 0 read/write ? ? ? ? ? ? r/w r/w .7 -.2 bits 7-2 0 always logic zero . 1-.0 clock output frequency selection bits 0 0 select fxx/64 0 1 select fxx/16 1 0 select fxx/8 1 1 select fxx/4
control registers s3c9234/p9234 4- 8 flags ? system flags register d5h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value x x x x ? ? ? ? read/write r/w r/w r/w r/w ? ? ? ? .7 carry flag (c) 0 operation does not generate a carry or borrow condition 1 operation generates a carry-out or borrow into high-order bit 7 .6 zero flag (z) 0 operation result is a non-zero value 1 operation result is zero .5 sign flag (s) 0 operation generates a positive number (msb = "0") 1 operation generates a negative number (msb = "1") .4 overflow flag (v) 0 operation result is +127 or 3 ?128 1 operation result is > +127 or < ?128 .3 -.0 not used for s3c9234/p9234.
s3c9234/p9234 control registers 4- 9 intpnd ? interrupt pending register d8 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 ? 0 0 0 read/write r/w r/w r/w r/w ? r/w r/w r/w .7 p2.7's interrupt pending bit 0 no interrupt pending (when read), c lear pending bit (when write) 1 interrupt is pending (when read) .6 p2.6's interrupt pending bit 0 no interrupt pending (when read), c lear pending bit (when write) 1 interrupt is pending (when read) . 5 p2.5's interrupt pending bit 0 no interrupt pending (when read), c lear pending bit (when write) 1 interrupt is pending (when read) . 4 p2.4's interrupt pending bit 0 no interrupt pending (when read), c lear pending bit (when write) 1 interrupt is pending (when read) .3 not used for s3c9234/p9234. . 2 p1.2's interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read) . 1 p1.1's interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read) . 0 p1.0's interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read)
control registers s3c9234/p9234 4- 10 lcon ? lcd control register d7 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 ? 0 read/write r/w r/w r/w r/w r/w r/w ? r/w .7 internal lcd dividing resistors enable bit 0 enable internal lcd dividing resistors 1 disable internal lcd dividing resistors .6-.5 lcd clock selection bits 0 0 fw/2 9 (64 hz) 0 1 fw/2 8 (128 hz) 1 0 fw/2 7 (256 hz) 1 1 fw/2 6 (512 hz) .4-.2 lcd duty and bias selection bits 0 0 0 1/4duty, 1/3bias 0 0 1 1/3duty, 1/3bias 0 1 0 1/3duty, 1/2bias 0 1 1 1/2duty, 1/2bias 1 x x static .1 not used for s3c9234/p9234. .0 lcd display control bits 0 all lcd signals are low (turn off the p-tr) 1 turn display on (turn on the p-tr) note: "x" means don't care.
s3c9234/p9234 control registers 4- 11 osccon ? oscillator control register d3 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value ? ? ? ? 0 0 ? 0 read/write ? ? ? ? r/w r/w ? r/w .7 -.4 not used for s3c9234/p9234. .3 main oscillator control bit 0 main oscillator run 1 main oscillator stop .2 sub oscillator control bit 0 sub oscillator run 1 sub oscillator stop .1 not used for s3c9234/p9234. .0 system clock selection bit 0 select main oscillator for system clock 1 select sub oscillator for system clock
control registers s3c9234/p9234 4- 12 p0con ? port 0 control register edh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p0.3/com3 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (com3) .5-.4 p0.2/com2 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (com2) .3-.2 p0.1/com1 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (com1) .1-.0 p0.0/com0 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (com0)
s3c9234/p9234 control registers 4- 13 p1conh ? port 1 control register high byte eeh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p1.7/buz configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (buz) .5-.4 p1.6/clkout configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (clkout) .3-.2 p1.5/tbout configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (tbout) .1-.0 p1.4/taout configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (taout)
control registers s3c9234/p9234 4- 14 p1conl ? port 1 control register low byte efh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p1.3/t1clk configuration bits 0 0 schmitt trigger input mode (t1clk) 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .5-.4 p1.2/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .3-.2 p1.1/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .1-.0 p1.0/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available
s3c9234/p9234 control registers 4- 15 p1int ?port 1 interrupt enable register f1h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value ? ? 0 0 0 0 0 0 read/write ? ? r/w r/w r/w r/w r/w r/w .7-.6 not used for s3c9234/p9234. .5-.4 p1.2/int external interrupt configuration bits 0 0 disable interrupt 0 1 enable interrupt by falling edge 1 0 enable interrupt by rising edge 1 1 enable interrupt by both falling and rising edge .3-.2 p1.1/int external interrupt configuration bits 0 0 disable interrupt 0 1 enable interrupt by falling edge 1 0 enable interrupt by rising edge 1 1 enable interrupt by both falling and rising edge .1-.0 p1.0/int external interrupt configuration bits 0 0 disable interrupt 0 1 enable interrupt by falling edge 1 0 enable interrupt by rising edge 1 1 enable interrupt by both falling and rising edge
control registers s3c9234/p9234 4- 16 p1pur ?port 1 pull-up resistors enable register f0h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 p1.7's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .6 p1.6's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .5 p1.5's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .4 p1.4's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .3 p1.3's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .2 p1.2's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .1 p1.1's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .0 p1.0's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor note: a pull-up resistor of port1 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function.
s3c9234/p9234 control registers 4- 17 p2conh ?port 2 control register high byte f2h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p2.7/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .5-.4 p2.6/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .3-.2 p2.5/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .1-.0 p2.4/int configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available
control registers s3c9234/p9234 4- 18 p2conl ? port 2 control register low byte f3h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p2.3 configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .5-.4 p2.2/si configuration bits 0 0 schmitt trigger input mode (si) 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 not available .3-.2 p2.1/so configuration bits 0 0 schmitt trigger input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (so) .1-.0 p2.0/sck configuration bits 0 0 schmitt trigger input mode (sck) 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (sck)
s3c9234/p9234 control registers 4- 19 p2int ? port 2 interrupt enable register f5 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r /w r/w r/w r/w .7 p2.7/int external interrupt edge selection bit 0 select falling edge 1 select rising edge .6 p2.7/int external interrupt enable bit 0 disable interrupt 1 enable interrupt .5 p2.6/int external interrupt edge selection bit 0 select falling edge 1 select rising edge .4 p2.6/int external interrupt enable bit 0 disable interrupt 1 enable interrupt .3 p2.5/int external interrupt edge selection bit 0 select falling edge 1 select rising edge .2 p2.5/int external interrupt enable bit 0 disable interrupt 1 enable interrupt .1 p2.4/int external interrupt edge selection bit 0 select falling edge 1 select rising edge .0 p2.4/int external interrupt enable bit 0 disable interrupt 1 enable interrupt
control registers s3c9234/p9234 4- 20 p2pur ?port 2 pull-up resistors enable register f4h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 p2.7's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .6 p2.6's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .5 p2.5's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .4 p2.4's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .3 p2.3's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .2 p2.2's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .1 p2.1's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .0 p2.0's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor note: a pull-up resistor of port 2 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function.
s3c9234/p9234 control registers 4- 21 p3conh ? port 3 control register high byte f6h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p3.7/seg24 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg24) .5-.4 p3.6/seg25 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg25) .3-.2 p3.5/seg26 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg26) .1-.0 p3.4/seg27 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg27)
control registers s3c9234/p9234 4- 22 p3conl ?port 3 control register low byte f7h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p3.3/seg28 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg28) .5-.4 p3.2/seg29 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg29) .3-.2 p3.1/seg30 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg30) .1-.0 p3.0/seg31 configuration bits 0 0 input mode 0 1 n-channel open-drain output mode 1 0 push-pull output mode 1 1 alternative function (seg31)
s3c9234/p9234 control registers 4- 23 p3pur ?port 3 pull-up resistors enable register f8 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 p3.7's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .6 p3.6's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .5 p3.5's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .4 p3.4's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .3 p3.3's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .2 p3.2's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .1 p3.1's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor .0 p3.0's pull-up resistor enable bit 0 disable pull-up resistor 1 enable pull-up resistor note: a pull-up resistor of port3 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function.
control registers s3c9234/p9234 4- 24 p4conh ? port 4 control register high byte f9h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p4.7/seg16 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg16) .5-.4 p4.6/seg17 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg17) .3-.2 p4.5/seg18 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg18) .1-.0 p4.4/seg19 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg19)
s3c9234/p9234 control registers 4- 25 p4conl ?port 4 control register low byte fah bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.6 p4.3/seg20 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg20) .5-.4 p4.2/seg21 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg21) .3-.2 p4.1/seg22 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg22) .1-.0 p4.0/seg23 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg23)
control registers s3c9234/p9234 4- 26 p5conh ? port 5 control register high byte fbh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 -.6 p5.7/seg8 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg8) .5-.4 p5.6/seg9 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg9) .3-.2 p5.5/seg10 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg10) .1-.0 p5.4/seg11 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg11)
s3c9234/p9234 control registers 4- 27 p5conl ? port 5 control register low byte fch bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 -.6 p5.3/seg12 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg12) .5-.4 p5.2/seg13 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg13) .3-.2 p5.1/seg14 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg14) .1-.0 p5.0/seg15 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg15)
control registers s3c9234/p9234 4- 28 p6con ? port 6 control register fdh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 -.6 p6.7-p6.6/seg0-seg1 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg0-seg1) .5-.4 p6.5-p6.4/seg2-seg3 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg2-seg3) .3-.2 p6.3-p6.2/seg4-seg5 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg4-seg5) .1-.0 p6.1-p6.0/seg6-seg7 configuration bits 0 0 input mode 0 1 input with pull-up resistor 1 0 push-pull output mode 1 1 alternative function (seg6-seg7)
s3c9234/p9234 control registers 4- 29 siocon ? sio control register d0 h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 sio shift clock selection bit 0 internal clock (p.s clock) 1 external clock (sck) .6 data direction control bit 0 msb-first mode 1 lsb-first mode . 5 sio mode selection bit 0 receive-only mode 1 transmit/ r eceive mode . 4 shift clock edge selection bit 0 tx at falling edges, rx at rising edges 1 tx at rising edges, rx at falling edges .3 sio counter clear and shift start bit 0 no action 1 clear 3-bit counter and start shifting . 2 sio shift operation enable bit 0 disable shifter and clock counter 1 enable shifter and clock counter . 1 sio interrupt enable bit 0 disable sio interrupt 1 enable sio interrupt . 1 sio interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read)
control registers s3c9234/p9234 4- 30 stpcon ? stop control register d6h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7-.0 stop control bits 1 0 1 0 0 1 0 1 enable stop instruction other values disable stop instruction note: before executing the stop instruction, the stpcon register must be set to "10100101b". otherwise the stop instruction will not execute.
s3c9234/p9234 control registers 4- 31 sym ? system mode register dfh bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value x x x x 0 0 0 0 read/write ? ? ? ? r/w r/w r/w r/w .7-.4 not used for s3c9234/p9234. .3 global interrupt enable bit 0 disable all interrupt (di instruction) 1 enable all interrupt (ei instruction) .2- .0 page selection bits 0 0 0 page 0 other values not available
control registers s3c9234/p9234 4- 32 t a con ? timer 1/a control register eb h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 timer 1 mode selection bit 0 two 8-bit timers mode (timer a/b) 1 one 16-bit timer mode (timer 1) .6-.4 timer 1/a clock selection bits 0 0 0 fxx/512 0 0 1 fxx/256 0 1 0 fxx/64 0 1 1 fxx/8 1 0 0 fxx (system clock) 1 0 1 fxt (sub clock) 1 1 0 t1clk (external clock) 1 1 1 not available .3 timer 1/a counter clear bit 0 no effect 1 clear the timer 1/a counter (when write) .2 timer 1/a counter enable bit 0 disable counting operation 1 enable counting operation .1 timer 1/a interrupt enable bit 0 disable interrupt 1 enable interrupt .0 timer 1/a interrupt pending bit 0 no interrupt pending bit (when read), clear pending bit (when write) 1 interrupt is pending (when read)
s3c9234/p9234 control registers 4- 33 t b con ? timer b control register ec h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value ? 0 0 0 0 0 0 0 read/write ? r/w r/w r/w r/w r/w r/w r/w .7 not used for s3c9234/p9234. .6-.4 timer b clock selection bits 0 0 0 fxx/512 0 0 1 fxx/256 0 1 0 fxx/64 0 1 1 fxx/8 1 0 0 fxt (sub clock) .3 timer b counter clear bit 0 no effect 1 clear the timer b counter (when write) .2 timer b counter enable bit 0 disable counting operation 1 enable counting operation .1 timer b interrupt enable bit 0 disable interrupt 1 enable interrupt .0 timer b interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read)
control registers s3c9234/p9234 4- 34 wtcon ? watch timer control register da h bit identifier .7 .6 .5 .4 .3 .2 .1 .0 reset value 0 0 0 0 0 0 0 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w .7 watch timer clock selection bit 0 select main clock divided by 2 7 (fx/128) 1 select sub clock (fxt) .6 watch timer interrupt enable bit 0 disable watch timer interrupt 1 enable watch timer interrupt .5-.4 buzzer signal selection bits 0 0 0.5 khz 0 1 1 khz 1 0 2 khz 1 1 4 khz .3-.2 watch timer speed selection bits 0 0 set watch timer interrupt to 1s 0 1 set watch timer interrupt to 0.5s 1 0 set watch timer interrupt to 0.25s 1 1 set watch timer interrupt to 3.91ms .1 watch timer enable bit 0 disable watch timer; clear frequency dividing circuits 1 enable watch timer .0 watch timer interrupt pending bit 0 no interrupt pending (when read), clear pending bit (when write) 1 interrupt is pending (when read)
s3c9234/p9234 interrupt structure 5- 1 5 interrupt structure overview the sam88rcri interrupt structure has two basic components: a vector, and sources. the number of interrupt sources can be serviced through a interrupt vector which is assigned in rom address 0000h?0001h. sources vector s1 s2 s3 sn 0000h 0001h notes: 1. the sam88rcri interrupt has only one vector address (0000h-0001h). 2. the number of sn value is expandable. figure 5- 1 . s3c9 -series interrupt type interrupt processing control points interrupt processing can be controlled in two ways: globally, or by specific interrupt level and source. the system- level control points in the interrupt structure are therefore: ? global interrupt enable and disable (by ei and di instructions) ? interrupt source en able and disable settings in the corresponding peripheral control register(s) enable/disable interrupt instructions (ei, di) the system mode register, sym (dfh), is used to enable and disable interrupt processing. sym.3 is the enable and disable bit for global interrupt processing, which you can set by modifying sym.3 . an enable interrupt (ei) instruction must be included in the initialization routine that follows a reset operation in order to enable interrupt processing. al though you can manipulate sym.3 directly to enable and disable interrupts during normal operation, we recommend that you use the ei and di instructions for this purpose.
interrupt structure s3c9234/p9234 5- 2 interrupt pending function types when the interrupt service routine has executed, the application program's service routine must clear the appropriate pending bit before the return from interrupt subroutine (iret) occurs. interrupt priority because there is not a interrupt priority register in sam87 rc r i , the order of service is determined by a sequence of source which is executed in interrupt service routine. s r q interrupt pending register global interrupt control (ei, di instruction) vector interrupt cycle interrpt priority is determind by software polling method "ei" instruction execution reset source interrupts source interrupt enable figure 5- 2 . interrupt function diagram
s3c9234/p9234 interrupt structure 5- 3 interrupt source service sequence the interrupt request polling and servicing sequence is as follows: 1. a source generates an interrupt request by setting the interrupt request pending bit to "1". 2. the cpu generates an interrupt acknowledge signal. 3. the service routine starts and the source's pending flag is cleared to "0" by software. 4. interrupt priority must be determined by software polling method. interrupt service routines before an interrupt request can be serviced, the following conditions must be met: ? interrupt proce ssing must be enabled (ei, sym.3 = "1") ? interrupt must be enabled at the interrupt's source (peripheral control register) if all of the above conditions are met, the interrupt request is acknowledged at the end of the instruction cycle. the cpu then initiates an interrupt machine cycle that completes the following processing sequence: 1. reset (clear to "0") the global interrupt enable bit in the sym register (di, sym. 3 = "0") to disable all subsequent interrupts. 2. save the program counter and status flags to stack. 3. branch to the interrupt vector to fetch the service routine's address. 4. pass control to the interrupt service ro utine. when the interrupt service routine is completed, an interrupt return instruction (iret) occurs. the iret restores the pc and status flags and sets sym.3 to "1"(ei), allowing the cpu to process the next interrupt request. generating interrupt vector addresses the interrupt vector area in the rom contains the address of the interrupt service routine. vectored interrupt processing follows this sequence: 1. push the program counter's low-byte value to s tack. 2. push the program counter's high-byte value to stack. 3. push the flags register values to stack. 4. fetch the service routine's high-byte address from the vector address 0000h. 5. fetch the service routine's low-byte address from the vector address 0001h. 6. branch to the service routine specified by the 16-bit vector address.
interrupt structure s3c9234/p9234 5- 4 s3c9234/p9234 interrupt structure the s3c9234/p9234 microcontroller has eleven peripheral interrupt sources: ? timer 1/a interrup t ? timer b interrupt ? sio interrupt ? watch timer interrupt ? three external interrupts for port 1 ? four external interrupts for port 2
s3c9234/p9234 interrupt structure 5- 5 sym.3 (ei, di) p1int.0 p1.0 external interript p1int.1 p1.1 external interript p1.2 external interript p1int.2 intpnd.0 intpnd.1 intpnd.2 p2.4 external interript p2int.4 p2.6 external interript p2.7 external interrupt p2.5 external interript p2int.5 p2int.6 p2int.7 tacon.1 tbcon.1 intpnd.4 intpnd.5 intpnd.6 intpnd.7 tacon.0 tbcon.0 siocon.1 wtcon.6 siocon.0 wtcon.0 0000h 0001h vector enable/disable pending sources timer b interrupt timer 1/a interrupt watch timer interrupt sio interrupt figure 5- 3 . s3c9234/p9234 interrupt structure
interrupt structure s3c9234/p9234 5- 6 f programming tip ? how to c lear an i nterrupt p ending b it as the following examples are shown, a load instruction should be used to clear an interrupt pending bit of intpnd register. examples: 1. ld intpnd, #11111011b ; clear p1.2's interrupt pending bit iret 2. and wtcon, #111111 10b ; clear watch timer interrupt pending bit iret
s3c9234/p9234 s am8 8rc ri instruction set 6 - 1 6 sam8 8rc r i instruction set overview the sam88rcri instruction set is designed to support the large register file. it includes a full complement of 8-bit arithmetic and logic operations. there are 41 instructions. no special i/o instructions are necessary because i/o control and data registers are mapped directly into the register file. flexible instructions for bit addressing, rotate, and shift operations complete the powerful data manipulation capabilities of the sam88rcri instruction set. register addressing to access an individual register, an 8-bit address in the range 0-255 or the 4-bit address of a working register is specified. paired registers can be used to construct 1 6 -bit program memory or data memory addresses. for detailed information about register addressing, please refer to section 2, "address spaces". addressing modes there are six addressing modes: register (r), indirect register (ir), indexed (x), direct (da), relative (ra), and immediate (im). for detailed descriptions of these addressing modes, please refer to section 3, "addressing modes".
sam8 8 ri instruction set s3c9234/p9234 6 - 2 table 6- 1. instruction group summary mnemonic operands instruction load instructions clr dst clear ld dst,src load ldc dst,src load program memory lde dst,src load external data memory ldcd dst,src load program memory and decrement lded dst,src load external data memory and decrement ldci dst,src load program memory and increment ldei dst,src load external data memory and increment pop dst pop from stack push src push to stack arithmetic instructions adc dst,src add with carry add dst,src add cp dst,src compare dec dst decrement inc dst increment sbc dst,src subtract with carry sub dst,src subtract logic instructions and dst,src logical and com dst complement or dst,src logical or xor dst,src logical exclusive or
s3c9234/p9234 s am8 8rc ri instruction set 6 - 3 table 6- 1 . instruction group summary (continued) mnemonic operands instruction program control instructions call dst call procedure iret interrupt return jp cc,dst jump on condition code jp dst jump unconditional jr cc,dst jump relative on condition code ret return bit manipulation instructions tcm dst,src test complement under mask tm dst,src test under mask rotate and shift instructions rl dst rotate left rlc dst rotate left through carry rr dst rotate right rrc dst rotate right through carry sra dst shift right arithmetic cpu control instructions ccf complement carry flag di disable interrupts ei enable interrupts idle enter idle mode nop no operation rcf reset carry flag scf set carry flag stop enter stop mode
sam8 8 ri instruction set s3c9234/p9234 6 - 4 flags register (flags) the flags register contains eight bits that describe the current status of cpu operations. four of these bits, flags.4 ? flags.7, can be tested and used with conditional jump instructions; flags register can be set or reset by instructions as long as its outcome does not affect the flags, such as, load instruction. logical and arithmetic instructions such as, and, or, xor, add, and sub can affect the flags register. for example, the and instruction updates the zero, sign and overflow flags based on the outcome of the and instruction. if the and instruction uses the flags register as the destination, then simultaneously, two write will occur to the flags register producing an unpredictable result. .7 .6 .5 .4 .3 .2 .1 .0 lsb msb system flags register (flags) d5h, r/w not mapped carry flag (c) zero flag (z) sign flag (s) overflow flag (v) figure 6- 1 . system flags register (flags) flag descriptions overflow flag (flags.4, v) the v flag is set to "1" when the result of a two's-complement operation is greater than + 127 or less than ? 128. it is also cleared to "0" following logic operations. sign flag (flags.5, s) following arithmetic, logic, rotate, or shift operations, the sign bit identifies the state of the msb of the result. a logic zero indicates a positive number and a logic one indicates a negative number. zero flag (flags.6, z) for arithmetic and logic operations, the z flag is set to "1" if the result of the operation is zero. for operations that test register bits, and for shift and rotate operations, the z flag is set to "1" if the result is logic zero. carry flag (flags.7, c) the c flag is set to "1" if the result from an arithmetic operation generates a carry-out from or a borrow to the bit 7 position (msb). after rotate and shift operations, it contains the last value shifted out of the specified register. program instructions can set, clear, or complement the carry flag.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 5 instruction set notation table 6- 2 . flag notation conventions flag description c carry flag z zero flag s sign flag v overflow flag 0 cleared to logic zero 1 set to logic one * set or cleared according to operation ? value is unaffected x value is undefined table 6- 3 . instruction set symbols symbol description dst destination operand src source operand @ indirect register address prefix pc program counter flags flags register (d5h) # immediate operand or register address prefix h hexadecimal number suffix d decimal number suffix b binary number suffix opc opcode
sam8 8 ri instruction set s3c9234/p9234 6 - 6 table 6- 4 . instruction notation conventions notation description actual operand range cc condition code see list of condition codes in table 6- 6. r working register only rn (n = 0?15) rr working register pair rrp (p = 0, 2, 4, ..., 14) r register or working register reg or rn (reg = 0?255, n = 0?15) rr register pair or working register pair reg or rrp (reg = 0?254, even number only, where p = 0, 2, ..., 14) ir indirect working register only @rn (n = 0?15) ir indirect register or indirect working register @rn or @reg (reg = 0?255, n = 0?15) irr indirect working register pair only @rrp (p = 0, 2, ..., 14) irr indirect register pair or indirect working register pair @rrp or @reg (reg = 0?254, even only, where p = 0, 2, ..., 14) x indexed addressing mode #reg[rn] (reg = 0?255, n = 0?15) xs indexed (short offset) addressing mode #addr[rrp] (addr = range ?128 to +127, where p = 0, 2, ..., 14) xl indexed (long offset) addressing mode #addr [rrp] (addr = range 0?8191, where p = 0, 2, ..., 14) da direct addressing mode addr (addr = range 0?8191) ra relative addressing mode addr (addr = number in the range +127 to ?128 that is an offset relative to the address of the next instruction) im immediate addressing mode #data (data = 0?255)
s3c9234/p9234 s am8 8rc ri instruction set 6 - 7 table 6- 5 . opcode quick reference opcode map lower nibble (hex) ? 0 1 2 3 4 5 6 7 u 0 dec r1 dec ir1 add r1,r2 add r1,ir2 add r2,r1 add ir2,r1 add r1,im p 1 rlc r1 rlc ir1 adc r1,r2 adc r1,ir2 adc r2,r1 adc ir2,r1 adc r1,im p 2 inc r1 inc ir1 sub r1,r2 sub r1,ir2 sub r2,r1 sub ir2,r1 sub r1,im e 3 jp irr1 sbc r1,r2 sbc r1,ir2 sbc r2,r1 sbc ir2,r1 sbc r1,im r 4 or r1,r2 or r1,ir2 or r2,r1 or ir2,r1 or r1,im 5 pop r1 pop ir1 and r1,r2 and r1,ir2 and r2,r1 and ir2,r1 and r1,im n 6 com r1 com ir1 tcm r1,r2 tcm r1,ir2 tcm r2,r1 tcm ir2,r1 tcm r1,im i 7 push r2 push ir2 tm r1,r2 tm r1,ir2 tm r2,r1 tm ir2,r1 tm r1,im b 8 ld r1, x, r2 b 9 rl r1 rl ir1 ld r2, x, r1 l a cp r1,r2 cp r1,ir2 cp r2,r1 cp ir2,r1 cp r1,im ldc r1, irr2, xl e b clr r1 clr ir1 xor r1,r2 xor r1,ir2 xor r2,r1 xor ir2,r1 xor r1,im ldc r2, irr2, xl c rrc r1 rrc ir1 ldc r1,irr2 ld r1, ir2 h d sra r1 sra ir1 ldc r2,irr1 ld ir1,im ld ir1, r2 e e rr r1 rr ir1 ldcd r1,irr2 ldci r1,irr2 ld r2,r1 ld r2,ir1 ld r1,im ldc r1, irr2, xs x f call irr1 ld ir2,r1 call da1 ldc r2, irr1, xs
sam8 8 ri instruction set s3c9234/p9234 6 - 8 table 6- 5 . opcode quick reference (continued) opcode map lower nibble (hex) ? 8 9 a b c d e f u 0 ld r1,r2 ld r2,r1 jr cc,ra ld r1,im jp cc,da inc r1 p 1 p 2 e 3 r 4 5 n 6 idle i 7 stop b 8 di b 9 ei l a re t e b iret c rcf h d scf e e ccf x f ld r1,r2 ld r2,r1 jr cc,ra ld r1,im jp cc,da inc r1 nop
s3c9234/p9234 s am8 8rc ri instruction set 6 - 9 condition codes the opcode of a conditional jump always contains a 4-bit field called the condition code (cc). this specifies under which conditions it is to execute the jump. for example, a conditional jump with the condition code for "equal" after a compare operation only jumps if the two operands are equal. condition codes are listed in table 6- 6. the carry (c), zero (z), sign (s), and overflow (v) flags are used to control the operation of conditional jump instructions. table 6- 6 . condition codes binary mnemonic description flags set 0000 f always false ? 1000 t always true ? 0111 (1) c carry c = 1 1111 (1) nc no carry c = 0 0110 (1) z zero z = 1 1110 (1) nz not zero z = 0 1101 pl plus s = 0 0101 mi minus s = 1 0100 ov overflow v = 1 1100 nov no overflow v = 0 0110 (1) eq equal z = 1 1110 (1) ne not equal z = 0 1001 ge greater than or equal (s xor v) = 0 0001 lt less than (s xor v) = 1 1010 gt greater than (z or (s xor v)) = 0 0010 le less than or equal (z or (s xor v)) = 1 1111 (1) uge unsigned greater than or equal c = 0 0111 (1) ult unsigned less than c = 1 1011 ugt unsigned greater than (c = 0 and z = 0) = 1 0011 ule unsigned less than or equal (c or z) = 1 notes: 1. i ndicate condition codes that are related to two different mnemonics but which test the same flag. for exa mple, z and eq are both true if the zero flag (z) is set, but after an add instruction, z would probably be used; after a cp instruction, however, eq would probably be used. 2. for operations involving unsigned numbers, the special condition codes uge, ult, ugt, and ule must be used.
sam8 8 ri instruction set s3c9234/p9234 6 - 10 instruction descriptions this section contains detailed information and programming examples for each instruction in the sam88rcri instruction set. information is arranged in a consistent format for improved readability and for fast referencing. the following information is included in each instruction description: ? instruction name (mnemonic) ? full instruction name ? source/destination format of the instruction operand ? shorthand notation of the instruction's operation ? textual description of the instruction's effect ? specific flag settings affected by the instruction ? detailed description of the instruction's format, execution time, and addressing mode(s) ? programming example(s) explaining how to use the instruction
s3c9234/p9234 s am8 8rc ri instruction set 6 - 11 adc ? add with carry adc dst,src operation: dst dst + src + c the source operand, along with the setting of the carry flag, is added to the destination operand and the sum is stored in the destination. the contents of the source are unaffected. two's-complement addition is performed. in multiple precision arithmetic, this instruction permits the carry from the addition of low-order operands to be carried into the addition of high-order operands. flags: c: set if there is a carry from the most significant bit of the result; cleared otherwise. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurs, that is, if both operands are of the same sign and the result is of the opposite sign; cleared otherwise. d: always cleared to "0". h: set if there is a carry from the most significant bit of the low-order four bits of the result; cleared otherwise. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 12 r r 6 13 r lr opc src dst 3 6 14 r r 6 15 r ir opc dst src 3 6 16 r im examples: given: r1 = 10h, r2 = 03h, c flag = "1", register 01h = 20h, register 02h = 03h, and register 03h = 0ah: adc r1,r2 ? r1 = 14h, r2 = 03h adc r1,@r2 ? r1 = 1bh, r2 = 03h adc 01h,02h ? register 01h = 24h, register 02h = 03h adc 01h,@02h ? register 01h = 2bh, register 02h = 03h adc 01h,#11h ? register 01h = 32h in the first example, destination register r1 contains the value 10h, the carry flag is set to "1", and the source working register r2 contains the value 03h. the statement "adc r1,r2" adds 03h and the carry flag value ("1") to the destination value 10h, leaving 14h in register r1.
sam8 8 ri instruction set s3c9234/p9234 6 - 12 add ? add add dst,src operation: dst dst + src the source operand is added to the destination operand and the sum is stored in the destination. the contents of the source are unaffected. two's-complement addition is performed. flags: c: set if there is a carry from the most significant bit of the result; cleared otherwise. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is, if both operands are of the same sign and the result is of the opposite sign; cleared otherwise. d: always cleared to "0". h: set if a carry from the low-order nibble occurred. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 02 r r 6 03 r lr opc src dst 3 6 04 r r 6 05 r ir opc dst src 3 6 06 r im examples: given: r1 = 12h, r2 = 03h, register 01h = 21h, register 02h = 03h, register 03h = 0ah: add r1,r2 ? r1 = 15h, r2 = 03h add r1,@r2 ? r1 = 1ch, r2 = 03h add 01h,02h ? register 01h = 24h, register 02h = 03h add 01h,@02h ? register 01h = 2bh, register 02h = 03h add 01h,#25h ? register 01h = 46h in the first example, destination working register r1 contains 12h and the source working register r2 contains 03h. the statement "add r1,r2" adds 03h to 12h, leaving the value 15h in register r1.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 13 and ? logical and and dst,src operation: dst dst and src the source operand is logically anded with the destination operand. the result is stored in the destination. the and operation results in a "1" bit being stored whenever the corresponding bits in the two operands are both logic ones; otherwise a "0" bit value is stored. the contents of the source are unaffected. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always cleared to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 52 r r 6 53 r lr opc src dst 3 6 54 r r 6 55 r ir opc dst src 3 6 56 r im examples: given: r1 = 12h, r2 = 03h, register 01h = 21h, register 02h = 03h, register 03h = 0ah: and r1,r2 ? r1 = 02h, r2 = 03h and r1,@r2 ? r1 = 02h, r2 = 03h and 01h,02h ? register 01h = 01h, register 02h = 03h and 01h,@02h ? register 01h = 00h, register 02h = 03h and 01h,#25h ? register 01h = 21h in the first example, destination working register r1 contains the value 12h and the source working register r2 contains 03h. the statement "and r1,r2" logically ands the source operand 03h with the destination operand value 12h, leaving the value 02h in register r1.
sam8 8 ri instruction set s3c9234/p9234 6 - 14 call ? call procedure call dst operation: sp sp ? 1 @sp pcl sp sp ?1 @sp pch pc dst the current contents of the program counter are pushed onto the top of the stack. the program counter value used is the address of the first instruction following the call instruction. the specified destination address is then loaded into the program counter and points to the first instruction of a procedure. at the end of the procedure the return instruction (ret) can be used to return to the original program flow. ret pops the top of the stack back into the program counter. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst opc dst 3 14 f6 da opc dst 2 12 f4 irr examples: given: r0 = 15h, r1 = 21h, pc = 1a47h, and sp = 0b2h: call 1521h ? sp = 0b0h (memory locations 00h = 1ah, 01h = 4ah, where 4ah is the address that follows the instruction.) call @rr0 ? sp = 0b0h (00h = 1ah, 01h = 49h) in the first example, if the program counter value is 1a47h and the stack pointer contains the value 0b2h, the statement "call 1521h" pushes the current pc value onto the top of the stack. the stack pointer now points to memory location 00h. the pc is then loaded with the value 1521h, the address of the first instruction in the program sequence to be executed. if the contents of the program counter and stack pointer are the same as in the first example, the statement "call @rr0" produces the same result except that the 49h is stored in stack location 01h (because the two-byte instruction format was used). the pc is then loaded with the value 1521h, the address of the first instruction in the program sequence to be executed.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 15 ccf ? complement carry flag ccf operation: c not c the carry flag (c) is complemented. if c = "1", the value of the carry flag is changed to logic zero; if c = "0", the value of the carry flag is changed to logic one. flags: c: complemented. no other flags are affected. format: bytes cycles opcode (hex) opc 1 4 ef example: given: the carry flag = "0": ccf if the carry flag = "0", the ccf instruction complements it in the flags register (0d5h), changing its value from logic zero to logic one.
sam8 8 ri instruction set s3c9234/p9234 6 - 16 clr ? clear clr dst operation: dst "0" the destination location is cleared to "0". flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 b0 r 4 b1 ir examples: given: register 00h = 4fh, register 01h = 02h, and register 02h = 5eh: clr 00h ? register 00h = 00h clr @01h ? register 01h = 02h, register 02h = 00h in register (r) addressing mode, the statement "clr 00h" clears the destination register 00h value to 00h. in the second example, the statement "clr @01h" uses indirect register (ir) addressing mode to clear the 02h register value to 00h.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 17 com ? complement com dst operation: dst not dst the contents of the destination location are complemented (one's complement); all "1s" are changed to "0s", and vice-versa. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always reset to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 60 r 4 61 ir examples: given: r1 = 07h and register 07h = 0f1h: com r1 ? r1 = 0f8h com @r1 ? r1 = 07h, register 07h = 0eh in the first example, destination working register r1 contains the value 07h (00000111b). the statement "com r1" complements all the bits in r1: all logic ones are changed to logic zeros, and vice-versa, leaving the value 0f8h (11111000b). in the second example, indirect register (ir) addressing mode is used to complement the value of destination register 07h (11110001b), leaving the new value 0eh (00001110b).
sam8 8 ri instruction set s3c9234/p9234 6 - 18 cp ? compare cp dst,src operation: dst ? src the source operand is compared to (subtracted from) the destination operand, and the appropriate flags are set accordingly. the contents of both operands are unaffected by the comparison. flags: c: set if a "borrow" occurred (src > dst); cleared otherwise. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the operands were of opposite signs and the sign of the result is of the same as the sign of the source operand; cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 a2 r r 6 a3 r lr opc src dst 3 6 a4 r r 6 a5 r ir opc dst src 3 6 a6 r im examples: 1. given: r1 = 02h and r2 = 03h: cp r1,r2 ? set the c and s flags destination working register r1 contains the value 02h and source register r2 contains the value 03h. the statement "cp r1,r2" subtracts the r2 value (source/subtrahend) from the r1 value (destination/minuend). because a "borrow" occurs and the difference is negative, c and s are "1". 2. given: r1 = 05h and r2 = 0ah: cp r1,r2 jp uge,skip inc r1 skip ld r3,r1 in this example, destination working register r1 contains the value 05h which is less than the contents of the source working register r2 (0ah). the statement "cp r1,r2" generates c = "1" and the jp instruction does not jump to the skip location. after the statement "ld r3,r1" executes, the value 06h remains in working register r3.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 19 dec ? decrement dec dst operation: dst dst ? 1 the contents of the destination operand are decremented by one. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is, dst value is ?128(80h) and result value is +127(7fh); cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 00 r 4 01 ir examples: given: r1 = 03h and register 03h = 10h: dec r1 ? r1 = 02h dec @r1 ? register 03h = 0fh in the first example, if working register r1 contains the value 03h, the statement "dec r1" decrements the hexadecimal value by one, leaving the value 02h. in the second example, the statement "dec @r1" decrements the value 10h contained in the destination register 03h by one, leaving the value 0fh.
sam8 8 ri instruction set s3c9234/p9234 6 - 20 di ? disable interrupts di operation: sym (2) 0 bit zero of the system mode register, sym.2, is cleared to "0", globally disabling all interrupt processing. interrupt requests will continue to set their respective interrupt pending bits, but the cpu will not service them while interrupt processing is disabled. flags: no flags are affected. format: bytes cycles opcode (hex) opc 1 4 8f example: given: sym = 04h: di if the value of the sym register is 04h, the statemen t "di" leaves the new value 00h in the register and clears sym.2 to "0", disabling interrupt processing.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 21 ei ? enable interrupts ei operation: sym (2) 1 an ei instruction sets bit 2 of the system mode register, sym.2 to "1". this allows interrupts to be serviced as they occur. if an interrupt's pending bit was set while interrupt processing was disabled (by executing a di instruction), it will be serviced when you execute the ei instruction. flags: no flags are affected. format: bytes cycles opcode (hex) opc 1 4 9f example: given: sym = 00h: ei if the sym register contains the value 00h, that is, if interrupts are currently disabled, the statement "ei" sets the sym register to 04h, enabling all interrupts (sym.2 is the enable bit for global interrupt processing) .
sam8 8 ri instruction set s3c9234/p9234 6 - 22 idle ? idle operation idle operation: the idle instruction stops the cpu clock while allowing system clock oscillation to continue. idle mode can be released by an interrupt request (irq) or an external reset operation. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src opc 1 4 6f ? ? example: the instruction idle stops the cpu clock but not the system clock.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 23 inc ? increment inc dst operation: dst dst + 1 the contents of the destination operand are incremented by one. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is dst value is +127(7fh) and result is ?128(80h); cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst dst | opc 1 4 re r r = 0 to f opc dst 2 4 20 r 4 21 ir examples: given: r0 = 1bh, register 00h = 0ch, and register 1bh = 0fh: inc r0 ? r0 = 1ch inc 00h ? register 00h = 0dh inc @r0 ? r0 = 1bh, register 01h = 10h in the first example, if destination working register r0 contains the value 1bh, the statement "inc r0" leaves the value 1ch in that same register. the next example shows the effect an inc instruction has on register 00h, assuming that it contains the value 0ch. in the third example, inc is used in indirect register (ir) addressing mode to increment the value of register 1bh from 0fh to 10h.
sam8 8 ri instruction set s3c9234/p9234 6 - 24 iret ? interrupt return iret iret operation: flags @sp sp sp + 1 pc @sp sp sp + 2 sym(2) 1 this instruction is used at the end of an interrupt service routine. it restores the flag register and the program counter. it also re-enables global interrupts. flags: all flags are restored to their original settings (that is, the settings before the interrupt occurred). format: iret (normal) bytes cycles opcode (hex) opc 1 6 bf
s3c9234/p9234 s am8 8rc ri instruction set 6 - 25 jp ? jump jp cc,dst (conditional) jp dst (unconditional) operation: if cc is true, pc dst the conditional jump instruction transfers program control to the destination address if the condition specified by the condition code (cc) is true; otherwise, the instruction following the jp instruction is executed. the unconditional jp simply replaces the contents of the pc with the contents of the specified register pair. control then passes to the statement addressed by the pc. flags: no flags are affected. format: (1) (2) bytes cycles opcode (hex) addr mode dst cc | opc dst 3 8 (3) ccd da cc = 0 to f opc dst 2 8 30 irr notes: 1. the 3-byte format is used for a conditional jump and the 2-byte format for an unconditional jump. 2. in the first byte of the three-byte instruction format (conditional jump), the condition code and the opcode are both four bits. examples: given: the carry flag (c) = "1", register 00 = 01h, and register 01 = 20h: jp c,label_w ? label_w = 1000h, pc = 1000h jp @00h ? pc = 0120h the first example shows a conditional jp. assuming that the carry flag is set to "1", the statement "jp c,label_w" replaces the contents of the pc with the value 1000h and transfers control to that location. had the carry flag not been set, control would then have passed to the statement immediately following the jp instruction. the second example shows an unconditional jp. the statement "jp @00" replaces the contents of the pc with the contents of the register pair 00h and 01h, leaving the value 0120h.
sam8 8 ri instruction set s3c9234/p9234 6 - 26 jr ? jump relative jr cc,dst operation: if cc is true, pc pc + dst if th e condition specified by the condition code (cc) is true, the relative address is added to the program counter and control passes to the statement whose address is now in the program counter; otherwise, the instruction following the jr instruction is executed (see list of condition codes). the range of the relative address is +127, ?128, and the original value of the program counter is taken to be the address of the first instruction byte following the jr statement. flags: no flags are affected. format: (1) bytes cycles opcode (hex) addr mode dst cc | opc dst 2 6 (2) ccb ra cc = 0 to f note : in the first byte of the two-byte instruction format, the condition code and the opcode are each four bits. example: given: the carry flag = "1" and label_x = 1ff7h: jr c,label_x ? pc = 1ff7h if the carry flag is set (that is, if the condition code is true), the statement "jr c,label_x" will pass control to the statement whose address is now in the pc. otherwise, the program instruction following the jr would be executed.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 27 ld ? load ld dst,src operation: dst src the contents of the source are loaded into the destination. the source's contents are unaffected. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src dst | opc src 2 4 rc r im 4 r8 r r src | opc dst 2 4 r9 r r r = 0 to f opc dst | src 2 4 c7 r lr 4 d7 ir r opc src dst 3 6 e4 r r 6 e5 r ir opc dst src 3 6 e6 r im 6 d6 ir im opc src dst 3 6 f5 ir r opc dst | src x 3 6 87 r x [r] opc src | dst x 3 6 97 x [r] r
sam8 8 ri instruction set s3c9234/p9234 6 - 28 ld ? load ld (continued) examples: given: r0 = 01h, r1 = 0ah, register 00h = 01h, register 01h = 20h, register 02h = 02h, loop = 30h, and register 3ah = 0ffh: ld r0,#10h ? r0 = 10h ld r0,01h ? r0 = 20h, register 01h = 20h ld 01h,r0 ? register 01h = 01h, r0 = 01h ld r1,@r0 ? r1 = 20h, r0 = 01h ld @r0,r1 ? r0 = 01h, r1 = 0ah, register 01h = 0ah ld 00h,01h ? register 00h = 20h, register 01h = 20h ld 02h,@00h ? register 02h = 20h, register 00h = 01h ld 00h,#0ah ? register 00h = 0ah ld @00h,#10h ? register 00h = 01h, register 01h = 10h ld @00h,02h ? register 00h = 01h, register 01h = 02, register 02h = 02h ld r0,#loop[r1] ? r0 = 0ffh, r1 = 0ah ld #loop[r0],r1 ? register 31h = 0ah, r0 = 01h, r1 = 0ah
s3c9234/p9234 s am8 8rc ri instruction set 6 - 29 ldc/lde ? load memory ldc/lde dst,src operation: dst src this instruction loads a byte from program or data memory into a working register or vice-versa. the source values are unaffected. ldc refers to program memory and lde to data memory. the assembler makes 'irr' or 'rr' values an even number for program memory and an odd number for data memory. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src 1. opc dst | src 2 10 c3 r irr 2. opc src | dst 2 10 d3 irr r 3. opc dst | src xs 3 12 e7 r xs [rr] 4. opc src | dst xs 3 12 f7 xs [rr] r 5. opc dst | src xl l xl h 4 14 a7 r xl [rr] 6. opc src | dst xl l xl h 4 14 b7 xl [rr] r 7. opc dst | 0000 da l da h 4 14 a7 r da 8. opc src | 0000 da l da h 4 14 b7 da r 9. opc dst | 0001 da l da h 4 14 a7 r da 10. opc src | 0001 da l da h 4 14 b7 da r notes: 1. the source (src) or working register pair [rr] for formats 5 and 6 cannot use register pair 0 ?1. 2. for formats 3 an d 4, the destination address 'xs [rr]' and the source address 'xs [rr]' are each one byte. 3. for formats 5 and 6, the destination address 'xl [rr] and the source address 'xl [rr]' are each two bytes. 4. the da and r source values for formats 7 and 8 are used to address program memory; the second set of values, used in formats 9 and 10, are used to address data memory.
sam8 8 ri instruction set s3c9234/p9234 6 - 30 ldc/lde ? load memory ldc/lde (continued) examples: given: r0 = 11h, r1 = 34h, r2 = 01h, r3 = 04h, r4 = 00h, r5 = 60h; program memory locations 0061 = aah, 0103h = 4fh, 0104h = 1a, 0105h = 6dh, and 1104h = 88h. external data memory locations 0061h = bbh, 0103h = 5fh, 0104h = 2ah, 0105h = 7dh, and 1104h = 98h: ldc r0,@rr2 ; r0 contents of program memory location 0104h ; r0 = 1ah, r2 = 01h, r3 = 04h lde r0,@rr2 ; r0 contents of external data memory location 0104h ; r0 = 2ah, r2 = 01h, r3 = 04h ldc * @rr2,r0 ; 11h (contents of r0) is loaded into program memory ; location 0104h (rr2), ; working registers r0, r2, r3 ? no change lde @rr2,r0 ; 11h (contents of r0) is loaded into external data memory ; location 0104h (rr2), ; working registers r0, r2, r3 ? no change ldc r0,#01h[rr4] ; r0 contents of program memory location 0061h ; (01h + rr4), ; r0 = aah, r2 = 00h, r3 = 60h lde r0,#01h[rr4] ; r0 contents of external data memory location 0061h ; (01h + rr4), r0 = bbh, r4 = 00h, r5 = 60h ldc (note) #01h[rr4],r0 ; 11h (contents of r0) is loaded into program me mory ; location 0061h (01h + 0060h) lde #01h[rr4],r0 ; 11h (contents of r0) is loaded into external data memory ; location 0061h (01h + 0060h) ldc r0,#1000h[rr2] ; r0 contents of program memory location 1104h ; (1000h + 0104h), r0 = 88h, r2 = 01h, r3 = 04h lde r0,#1000h[rr2] ; r0 contents of external data memory location 1104h ; (1000h + 0104h), r0 = 98h, r2 = 01h, r3 = 04h ldc r0,1104h ; r0 contents of program memory location 1104h, ; r0 = 88h lde r0,11 04h ; r0 contents of external data memory location 1104h, ; r0 = 98h ldc (note) 1105h,r0 ; 11h (contents of r0) is loaded into program memory ; location 1105h, (1105h) 11h lde 1105h,r0 ; 11h (contents of r0) is loaded into external data memory ; location 1105h, (1105h) 11h note: these instructions are not supported by masked rom type devices.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 31 ldcd/lded ? load memory and decrement ldcd/lded dst,src operation: dst src rr rr ? 1 these instructions are used for user stacks or block transfers of data from program or data memory to the register file. the address of the memory location is specified by a working register pair. the contents of the source location are loaded into the destination location. the memory address is then decremented. the contents of the source are unaffected. ldcd references program memory and lded references external data memory. the assembler makes ? irr ? an even number for program memory and an odd number for data memory. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 10 e2 r irr examples: given: r6 = 10h, r7 = 33h, r8 = 12h, program memory location 1033h = 0cdh, and external data memory location 1033h = 0ddh: ldcd r8,@rr6 ; 0cdh (contents of program memory location 1033h) is ; loaded into r8 and rr6 is decremented by one ; r8 = 0cdh, r6 = 10h, r7 = 32h (rr6 ? rr6 - 1) lded r8,@rr6 ; 0ddh (contents of data memory location 10 33h) is ; loaded into r8 and rr6 is decremented by one ; (rr6 ? rr6 - 1) r8 = 0ddh, r6 = 10h, r7 = 32h
sam8 8 ri instruction set s3c9234/p9234 6 - 32 ldci/ldei ? load memory and increment ldci/ldei dst,src operation: dst src rr rr + 1 these instructions are used for user stacks or block transfers of data from program or data memory to the register file. the address of the memory location is specified by a working register pair. the contents of the source location are loaded into the destination location. the memory address is then incremented automatically. the contents of the source are unaffected. ldci refers to program memory and ldei refers to external data memory. the assembler makes 'irr' even for program memory and odd for data memory. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 10 e3 r irr examples: given: r6 = 10h, r7 = 33h, r8 = 12h, program memory locations 1033h = 0cdh and 1034h = 0c5h; external data memory locations 1033h = 0ddh and 1034h = 0d5h: ldci r8,@rr6 ; 0cdh (contents of program memory location 1033h) is ; loaded into r8 and rr6 is incremented by one ; (rr6 rr6 + 1) r8 = 0cdh, r6 = 10h, r7 = 34h ldei r8,@rr6 ; 0ddh (contents of data m emory location 1033h) is ; loaded into r8 and rr6 is incremented by one ; (rr6 rr6 + 1) r8 = 0ddh, r6 = 10h, r7 = 34h
s3c9234/p9234 s am8 8rc ri instruction set 6 - 33 nop ? no operation nop operation: no action is performed when the cpu executes this instruction. typi cally, one or more nops are executed in sequence in order to effect a timing delay of variable duration. flags: no flags are affected. format: bytes cycles opcode (hex) opc 1 4 ff example: when the instruction nop is encountered in a program, no operation occurs. instead, there is a delay in instruction execution time.
sam8 8 ri instruction set s3c9234/p9234 6 - 34 or ? logical or or dst,src operation: dst dst or src the source operand is logically ored with the destination operand and the result is stored in the destination. the contents of the source are unaffected. the or operation results in a "1" being stored whenever either of the corresponding bits in the two operands is a "1"; otherwise a "0" is stored. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always cleared to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 42 r r 6 43 r lr opc src dst 3 6 44 r r 6 45 r ir opc dst src 3 6 46 r im examples: given: r0 = 15h, r1 = 2ah, r2 = 01h, register 00h = 08h, register 01h = 37h, and register 08h = 8ah: or r0,r1 ? r0 = 3fh, r1 = 2ah or r0,@r2 ? r0 = 37h, r2 = 01h, register 01h = 37h or 00h,01h ? register 00h = 3fh, register 01h = 37h or 01h,@00h ? register 00h = 08h, register 01h = 0bfh or 00h,#02h ? register 00h = 0ah in the first example, if working register r0 contains the value 15h and re gister r1 the value 2ah, the statement "or r0,r1" logical-ors the r0 and r1 register contents and stores the result (3fh) in destination register r0. the other examples show the use of the logical or instruction with the various addressing modes and formats.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 35 pop ? pop from stack pop dst operation: dst @sp sp sp + 1 the contents of the location addressed by the stack pointer are loaded into the destination. the stack pointer is then incremented by one. flags: no flags affected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 8 50 r 8 51 ir examples: given: register 00h = 01h, register 01h = 1bh, sp (0d9h) = 0bbh, and stack register 0bbh = 55h: pop 00h ? register 00h = 55h, sp = 0bch pop @00h ? register 00h = 01h, register 01h = 55h, sp = 0bch in the first example, general register 00h contains the value 01h. the statement "pop 00h" loads the contents of location 0bbh (55h) into destination register 00h and then increments the stack pointer by one. register 00h then contains the value 55h and the sp points to location 0bch.
sam8 8 ri instruction set s3c9234/p9234 6 - 36 push ? push to stack push src operation: sp sp ? 1 @sp src a push instruction decrements the stack pointer value and loads the contents of the source (src) into the location addressed by the decremented stack pointer. the operation then adds the new value to the top of the stack. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst opc src 2 8 70 r 8 71 ir examples: given: register 40h = 4fh, register 4fh = 0aah, sp = 0c0h: push 40h ? register 40h = 4fh, stack register 0bfh = 4fh, sp = 0bfh push @40h ? register 40h = 4fh, register 4fh = 0aah, stack register 0bfh = 0aah, sp = 0bfh in the first example, if the stack pointer contains the value 0c0h, and general register 40h the value 4fh, the statement "push 40h" decrements the stack pointer from 0c0 to 0bfh. it then loads the contents of register 40h into location 0bfh. register 0bfh then contains the value 4fh and sp points to location 0bfh.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 37 rcf ? reset carry flag rcf rcf operation: c 0 the carry flag is cleared to logic zero, regardless of its previous value. flags: c: cleared to "0". no other flags are affected. format: bytes cycles opcode (hex) opc 1 4 cf example: given: c = "1" or "0": the instruction rcf clears the carry flag (c) to logic zero.
sam8 8 ri instruction set s3c9234/p9234 6 - 38 ret ? return ret operation: pc @sp sp sp + 2 the ret instructio n is normally used to return to the previously executing procedure at the end of a procedure entered by a call instruction. the contents of the location addressed by the stack pointer are popped into the program counter. the next statement that is executed is the one that is addressed by the new program counter value. flags: no flags are affected. format: bytes cycles opcode (hex) opc 1 8 af example: given: sp = 0bch, (sp) = 101ah, and pc = 1234: ret ? pc = 101ah, sp = 0beh the statement "ret" pops the contents of stack pointer location 0bch (10h) into the high byte of the program counter. the stack pointer then pops the value in location 0bdh (1ah) into the pc's low byte and the instruction at location 101ah is executed. the stack pointer now points to memory location 0beh.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 39 rl ? rotate left rl dst operation: c dst (7) dst (0) dst (7) dst (n + 1) dst (n), n = 0?6 the contents of the destination operand are rotated left one bit position. the initial value of bit 7 is moved to the bit zero (lsb) position and also replaces the carry flag. c 7 0 flags: c: set if the bit rotated from the most significant bit position (bit 7) was "1". z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the sign of the destination changed during rotation; cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 90 r 4 91 ir examples: given: register 00h = 0aah, register 01h = 02h and register 02h = 17h: rl 00h ? register 00h = 55h, c = "1" rl @01h ? register 01h = 02h, register 02h = 2eh, c = "0" in the first example, if general register 00h contains the value 0aah (10101010b), the statement "rl 00h" rotates the 0aah value left one bit position, leaving the new value 55h (01010101b) and setting the carry and overflow flags.
sam8 8 ri instruction set s3c9234/p9234 6 - 40 rlc ? rotate left through carry rlc dst operation: dst (0) c c dst (7) dst (n + 1) dst (n), n = 0?6 the contents of the destination operand with the carry flag are rotated left one bit position. the initial value of bit 7 replaces the carry flag (c); the initial value of the carry flag replaces bit zero. c 7 0 flags: c: set if the bit rotated from the most significant bit position (bit 7) was "1". z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the sign of the destination changed during rotation; cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 10 r 4 11 ir examples: given: register 00h = 0aah, register 01h = 02h, and register 02h = 17h, c = "0": rlc 00h ? register 00h = 54h, c = "1" rlc @01h ? register 01h = 02h, register 02h = 2eh, c = "0" in th e first example, if general register 00h has the value 0aah (10101010b), the statement "rlc 00h" rotates 0aah one bit position to the left. the initial value of bit 7 sets the carry flag and the initial value of the c flag replaces bit zero of register 00h, leaving the value 55h (01010101b). the msb of register 00h resets the carry flag to "1" and sets the overflow flag.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 41 rr ? rotate right rr dst operation: c dst (0) dst (7) dst (0) dst (n) dst (n + 1), n = 0?6 the conte nts of the destination operand are rotated right one bit position. the initial value of bit zero (lsb) is moved to bit 7 (msb) and also replaces the carry flag (c). c 7 0 flags: c: set if the bit rotated from the least significant bit position (bit zero) was "1". z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the sign of the destination changed during rotation; cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 e0 r 4 e1 ir examples: given: register 00h = 31h, register 01h = 02h, and register 02h = 17h: rr 00h ? register 00h = 98h, c = "1" rr @01h ? register 01h = 02h, register 02h = 8bh, c = "1" in the first example, if general register 00h contains the value 31h (00110001b), the statement "rr 00h" rotates this value one bit position to the right. the initial value of bit zero is moved to bit 7, leaving the new value 98h (10011000b) in the destination register. the initial bit zero also resets the c flag to "1" and the sign flag and overflow flag are also set to "1".
sam8 8 ri instruction set s3c9234/p9234 6 - 42 rrc ? rotate right through carry rrc dst operation: dst (7) c c dst (0) dst (n) dst (n + 1), n = 0?6 the contents of the destination operand and the carry flag are rotated right one bit position. the initial value of bit zero (lsb) replaces the carry flag; the initial value of the carry flag replaces bit 7 (msb). c 7 0 flags: c: set if the bit rotated from the least significant bit position (bit zero) was "1". z: set if the result is "0" cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the sign of the destination changed during rotation; cleared otherwise. d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 c0 r 4 c1 ir examples: given: register 00h = 55h, register 01h = 02h, register 02h = 17h, and c = "0": rrc 00h ? register 00h = 2ah, c = "1" rrc @01h ? register 01h = 02h, register 02h = 0bh, c = "1" in the first example, if general register 00h contains the value 55h (01010101b), the statement "rrc 00h" rotates this value one bit position to the right. the initial value of bit zero ("1") replaces the carry flag and the initial value of the c f lag ("1") replaces bit 7. this leaves the new value 2ah (00101010b) in destination register 00h. the sign flag and overflow flag are both cleared to "0".
s3c9234/p9234 s am8 8rc ri instruction set 6 - 43 sbc ? subtract with carry sbc dst,src operation: dst dst ? src ? c the source operand, along with the current value of the carry flag, is subtracted from the destination operand and the result is stored in the destination. the contents of the source are unaffected. subtraction is performed by adding the two's-complement of the source operand to the destination operand. in multiple precision arithmetic, this instruction permits the carry ("borrow") from the subtraction of the low-order operands to be subtracted from the subtraction of high-order operands. flags: c: set if a borrow occurred (src > dst); cleared otherwise. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the operands were of opposite sign and the sign f the result is the same as the sign of the source; cleared otherwise. d: always set to "1". h: cleared if there is a carry from the most significant bit of the low-order four bits of the result; set otherwise, indicating a "borrow". format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 32 r r 6 33 r lr opc src dst 3 6 34 r r 6 35 r ir opc dst src 3 6 36 r im examples: given: r1 = 10h, r2 = 03h, c = "1", register 01h = 20h, register 02h = 03h, and register 03h = 0ah: sbc r1,r2 ? r1 = 0ch, r2 = 03h sbc r1,@r2 ? r1 = 05h, r2 = 03h, register 03h = 0ah sbc 01h,02h ? register 01h = 1ch, register 02h = 03h sbc 01h,@02h ? register 01h = 15h,register 02h = 03h, register 03h = 0ah sbc 01h,#8ah ? register 01h = 95h; c, s, and v = "1" in the first example, if working register r1 contains the value 10h and register r2 the value 03h, the statement "sbc r1,r2" subtracts the source value (03h) and the c flag value ("1") from the destination (10h) and then stores the result (0ch) in register r1.
sam8 8 ri instruction set s3c9234/p9234 6 - 44 scf ? set carry flag scf operation: c 1 the carry flag (c) is set to logic one, regardless of its previous value. flags: c: set to "1". no other flags are affected. format: bytes cycles opcode (hex) opc 1 4 df example: the statement scf sets the carry flag to logic one.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 45 sra ? shift right arithmetic sra dst operation: dst (7) dst (7) c dst (0) dst (n) dst (n + 1), n = 0?6 an arithmetic shift-right of one bit positio n is performed on the destination operand. bit zero (the lsb) replaces the carry flag. the value of bit 7 (the sign bit) is unchanged and is shifted into bit position 6. c 7 6 0 flags: c: set if the bit shifted from the lsb position (bit zero) was "1". z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: always cleared to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst opc dst 2 4 d0 r 4 d1 ir examples: given: register 00h = 9ah, register 02h = 03h, register 03h = 0bch, and c = "1": sra 00h ? register 00h = 0cd, c = "0" sra @02h ? register 02h = 03h, register 03h = 0deh, c = "0" in the first example, if general register 00h contains the value 9ah (10011010b), the statement "sra 00h" shifts the bit values in register 00h right one bit position. bit zero ("0") clears the c flag and bit 7 ("1") is then shifted into the bit 6 position (bit 7 remains unchanged). this leaves the value 0cdh (11001101b) in destination register 00h.
sam8 8 ri instruction set s3c9234/p9234 6 - 46 stop ? stop operation stop operation: the stop instruction stops both the cpu clock and system clock and causes the microcontroller to enter stop mode. during stop mode, the contents of on-chip cpu registers, peripheral registers, and i/o port control and data registers are retained. stop mode can be released by an external reset operation or external interrupt input. for the reset operation, the reset pin must be held to low level until the required oscillation stabilization interval has elapsed. flags: no flags are affected. format: bytes cycles opcode (hex) addr mode dst src opc 1 4 7f ? ? example: the statement stop halts all microcontroller operations.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 47 sub ? subtract sub dst,src operation: dst dst ? src the source operand is subtracted from the destination operand and the result is stored in the destination. the contents of the source are unaffected. subtraction is performed by adding the two's complement of the source operand to the destination operand. flags: c: set if a "borrow" occurred; cleared otherwise. z: set if the result is "0"; cleared otherwise. s: set if the result is negative; cleared otherwise. v: set if arithmetic overflow occurred, that is, if the operands were of opposite signs and the sign of the result is of the same as the sign of the source operand; cleared otherwise. d: always set to "1". h: cleared if there is a carry from the most significant bit of the low-order four bits of the result; set otherwise indicating a "borrow". format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 22 r r 6 23 r lr opc src dst 3 6 24 r r 6 25 r ir opc dst src 3 6 26 r im examples: given: r1 = 12h, r2 = 03h, register 01h = 21h, register 02h = 03h, register 03h = 0ah: sub r1,r2 ? r1 = 0fh, r2 = 03h sub r1,@r2 ? r1 = 08h, r2 = 03h sub 01h,02h ? register 01h = 1eh, regi ster 02h = 03h sub 01h,@02h ? register 01h = 17h, register 02h = 03h sub 01h,#90h ? register 01h = 91h; c, s, and v = "1" sub 01h,#65h ? register 01h = 0bch; c and s = "1", v = "0" in the first example, if working register r1 contains the value 12h and if register r2 contains the value 03h, the statement "sub r1,r2" subtracts the source value (03h) from the destination value (12h) and stores the result (0fh) in destination register r1.
sam8 8 ri instruction set s3c9234/p9234 6 - 48 tcm ? test complement under mask tcm dst,src operation: (not dst) and src this instruction tests selected bits in the destination operand for a logic one value. the bits to be tested are specified by setting a "1" bit in the corresponding position of the source operand (mask). the tcm statement complements the destination operand, which is then anded with the source mask. the zero (z) flag can then be checked to determine the result. the destination and source operands are unaffected. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always cleared to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 62 r r 6 63 r lr opc src dst 3 6 64 r r 6 65 r ir opc dst src 3 6 66 r im examples: given: r0 = 0c7h, r1 = 02h, r2 = 12h, register 00h = 2bh, register 01h = 02h, and register 02h = 23h: tcm r0,r1 ? r0 = 0c7h, r1 = 02h, z = "1" tcm r0,@r1 ? r0 = 0c7 h, r1 = 02h, register 02h = 23h, z = "0" tcm 00h,01h ? register 00h = 2bh, register 01h = 02h, z = "1" tcm 00h,@01h ? register 00h = 2bh, register 01h = 02h, register 02h = 23h, z = "1" tcm 00h,#34 ? register 00h = 2bh, z = "0" in the first example, if working register r0 contains the value 0c7h (11000111b) and register r1 the value 02h (00000010b), the statement "tcm r0,r1" tests bit one in the destination register for a "1" value. because the mask value corresponds to the test bit, the z flag is set to logic one and can be tested to determine the result of the tcm operation.
s3c9234/p9234 s am8 8rc ri instruction set 6 - 49 tm ? test under mask tm dst,src operation: dst and src this instruction tests selected bits in the destination operand for a logic zero value. the bits to be tested are specified by setting a "1" bit in the corresponding position of the source operand (mask), which is anded with the destination operand. the zero (z) flag can then be checked to determine the result. the destination and source operands are unaffected. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always reset to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 72 r r 6 73 r lr opc src dst 3 6 74 r r 6 75 r ir opc dst src 3 6 76 r im examples: given: r0 = 0c7h, r1 = 02h, r2 = 18h, register 00h = 2bh, register 01h = 02h, and regis ter 02h = 23h: tm r0,r1 ? r0 = 0c7h, r1 = 02h, z = "0" tm r0,@r1 ? r0 = 0c7h, r1 = 02h, register 02h = 23h, z = "0" tm 00h,01h ? register 00h = 2bh, register 01h = 02h, z = "0" tm 00h,@01h ? register 00h = 2bh, register 01h = 02h, register 02h = 23h, z = "0" tm 00h,#54h ? register 00h = 2bh, z = "1" in the first example, if working register r0 contains the value 0c7h (11000111b) and register r1 the value 02h (00000010b), the statement "tm r0,r1" tests bit one in the destination register for a "0" value. because the mask value does not match the test bit, the z flag is cleared to logic zero and can be tested to determine the result of the tm operation.
sam8 8 ri instruction set s3c9234/p9234 6 - 50 xor ? logical exclusive or xor dst,src operation: dst dst xor src the source operand is logically exclusive-ored with the destination operand and the result is stored in the destination. the exclusive-or operation results in a "1" bit being stored whenever the corresponding bits in the operands are different; otherwise, a "0" bit is stored. flags: c: unaffected. z: set if the result is "0"; cleared otherwise. s: set if the result bit 7 is set; cleared otherwise. v: always reset to "0". d: unaffected. h: unaffected. format: bytes cycles opcode (hex) addr mode dst src opc dst | src 2 4 b2 r r 6 b3 r lr opc src dst 3 6 b4 r r 6 b5 r ir opc dst src 3 6 b6 r im examples: given: r0 = 0c7h, r1 = 02h, r2 = 18h, register 00h = 2bh, register 01h = 02h, and register 02h = 23h: xor r0,r1 ? r0 = 0c5h, r1 = 02h xor r0,@r1 ? r0 = 0e4h, r1 = 02h, register 02h = 23h xor 00h,01h ? register 00h = 29h, register 01h = 02h xor 00h,@01h ? register 00h = 08h, register 01h = 02h, register 02h = 23h xor 00h,#54h ? register 00h = 7fh in the first example, if working register r0 contains the value 0c7h and if register r1 contains the value 02h, the statement "xor r0,r1" logically exclusive-ors the r1 value with the r0 value and stores the result (0c5h) in the destination register r0.
s3c9234/p9234 clock circuits 7- 1 7 clock circuits overview the s3c9234/p9234 microcontroller has two oscillator circuits: a main clock, and a sub clock circuit. the cpu and peripheral hardware operate on the system clock frequency supplied through these circuits. the maximum cpu clock frequency, is determined by clkcon register settings . system clock circuit the system clock circuit has the following components: ? c rystal , ceramic resonator , rc oscillation source (main clock only), or an external clock ? oscillator stop and wake-up functions ? programmable frequency divider for the cpu clock (f xx divided by 1, 2, 8, or 16 ) ? clock circuit control register, clkcon ? oscillator control register, osccon ? clock output control register, clocon cpu clock notation in this document, the following notation is used for descriptions of the cpu clock: fx main clock fxt sub clock fxx selected system clock
clock circuits s3c9 234/p9234 7- 2 main oscillator circuits x in x out figure 7-1. crystal/ceramic oscillator (fx) x in x out figure 7-2. external oscillator (fx) x in x out r figure 7-3. rc oscillator (fx) sub oscillator circuits xt in xt out 32.768 khz figure 7-4. crystal/ceramic oscillator (fxt) xt in xt out figure 7-5. external oscillator (fxt)
s3c9234/p9234 clock circuits 7- 3 clock status during power-down modes the two power-down modes, stop mode and idle mode, affect the system clock as follows: ? in stop mode, the main oscillator is halted. stop mode is released, and the oscillator started, by a reset operation, by an external interrupt, or by an internal interrupt if sub clock is selected as the clock source (when the fx is selected as system clock). ? in idle mode, the internal clock signal is gated away from the cpu, but continues to be supplied to the interrupt structure, timer a/b, and watch timer. idle mode is released by a reset or by an external or internal interrupts. 1/1-1/4096 frequency dividing circuit stop release main-system oscillator circuit selector 1 f x f x t stop sub-system oscillator circuit int osccon.0 osccon.3 osccon.2 1/1 1/16 1/2 1/8 selector 2 stpcon stop osc inst. f xx clkcon.4-.3 cpu stop watch timer basic timer timer/counters watch timer lcd controller sio lcd controller figure 7-6. system clock circuit diagram
clock circuits s3c9 234/p9234 7- 4 system clock control register (clkcon) the system clock control register, clkcon, is located in address d4h. it is read/write addressable and has the following functions: ? oscillator irq wake-up function enable/disable ? oscillator frequency divide-by value clkcon register settings control whether or not an external interrupt can be used to trigger a stop mode release (this is called the "irq wake-up" function). the irq "wake-up" enable bit is clkcon.7. after a reset, the external interrupt oscillator wake-up function is enabled, the main oscillator is activated, and the f x /16 (the slowest clock speed) is selected as the cpu clock. if necessary, you can then increase the cpu clock speed to f x , f x /2, or f x /8 by setting the clkcon, and you can change system clock from main clock to sub clock by setting the osccon. system clock control register (clkcon) d4h, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb not used for s3c9234/p9234 (must keep always "0") divide-by selection bits for cpu clock frequency: 00 = f xx/16 01 = f xx/8 10 = f x x/2 11 = f xx oscillator irq wake-up enable bit: 0 = enable irq for main oscillator wake-up function in power down mode 1 = disable irq for main oscillator wake-up function in power down mode not used for s3c9234/p9234 (must keep always "0") figure 7-7. system clock control register (clkcon)
s3c9234/p9234 clock circuits 7- 5 clock output control register (clocon) the clock output control register, clocon, is located in address feh. it is read/write addressable and has the following functions; ? clock output frequency selection after a reset, fxx/64 is select for clock output frequency because the reset value of clocon.1-.0 is "0". clock output control register (clocon) feh, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb not used for s3c9234/p9234. (must keep always "0") clock output frequency selection bits: 00 = select fxx/64 01 = select fxx/16 10 = select fxx/8 11 = select fxx/4 figure 7-8. clock output control register (clocon) clocon.1-.0 clkout mux fxx/64 fxx/16 fxx/8 fxx/4 p1conh.5-.4 figure 7-9. clock output block diagram
clock circuits s3c9 234/p9234 7- 6 oscillator control register (osccon) the oscillator control register, osccon, is located in address d3h. it is read/write addressable and has the following functions: ? system clock selection ? main oscillator control ? sub oscillator control osccon.0 register settings select main clock or sub clock as system clock. after a reset, main clock is selected for system clock because the reset value of osccon.0 is "0". the main oscillator can be stopped or run by setting osccon.3. the sub oscillator can be stopped or run by setting osccon.2. oscillator control register (osccon) d3h, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb not used for s3c9234/p9234 main oscillator control bit: 0 = main oscillator run 1 = main oscillator stop sub oscillator control bit: 0 = sub oscillator run 1 = sub oscillator stop not used for s3c9234/p9234 system clock selection bit: 0 = main oscillator select 1 = sub oscillator select figure 7-10. oscillator control register (osccon)
s3c9234/p9234 clock circuits 7- 7 switching the cpu clock data loadings in the oscillator control register, osccon, determine whether a main or a sub clock is selected as the cpu clock, and also how this frequency is to be divided by setting clkcon. this makes it possible to switch dynamically between main and sub clocks and to modify operating frequencies. osccon.0 select the main clock (fx) or the sub clock (fxt) for the system clock. osccon .3 start or stop main clock oscillation, and osccon.2 start or stop sub clock oscillation. clkcon.4?.3 control the frequency divider circuit, and divide the selected fxx clock by 1, 2, 8, or 16. for example, you are using the default system clock (normal operating mode and a main clock of fx/16) and you want to switch from the fx clock to a sub clock and to stop the main clock. to do this, you need to set osccon.0 to "1", take a delay, and osccon.3 to "1" sequently. this switches the clock from fx to fxt and stops main clock oscillation. the following steps must be taken to switch from a sub clock to the main clock: first, set osccon.3 to "0" to enable main system clock oscillation. then, after a certain number of machine cycles has elapsed, select the main clock by setting osccon.0 to "0". f programming tip ? switching the cpu clock 1. this example shows how to change from the main clock to the sub clock: ma2sub or osccon,#01h ; switches to the sub clock call dly16 ; delay 16ms or osccon,#08h ; stop the main clock oscillation ret 2. this example shows how to change from sub clock to main clock: sub2ma and osccon,#0f7h ; start the main clock oscillation call dly16 ; delay 16 ms and osccon,#0feh ; switch to the main clock ret dly16 ld r0,#20h del nop dec r0 jr nz,del ret
clock circuits s3c9 234/p9234 7- 8 stop control register (stpcon) the stop control register, stpcon, is located in address d6h. it is read/write addressable and has the following functions: ? enable/disable stop instruction after a reset, the stop instruction is disabled, because the value of stpcon is "other values". if necessary, you can use the stop instruction by setting the value of stpcon to "10100101b". stop control register (stpcon) d6h, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb stop control bits: 10100101 = enable stop instruction other values = disable stop instruction figure 7-11. stop control register (stpcon) f programming tip ? how to use stop instruction this example shows how to go stop mode when a main clock is selected as the system clock. ld stopcon,#1010010b ; enable stop instruction stop ; enter stop mode nop nop nop ; release stop mode ld stopcon,#0000000 0b ; disable stop instruction
s3c9234/p9234 reset and power-down 8- 1 8 reset and power-down system reset overview during a power-on reset, the voltage at v dd goes to high level and the reset pin is forced to low level. the reset signal is input through a schmitt trigger circuit where it is then synchronized with the cpu clock. this procedure brings s3c9234/p9234 into a known operating status. to allow time for internal cpu clock oscillation to stabilize, the reset pin must be held to low level for a minimum time interval after the power supply comes within tolerance. the minimum required oscillation stabilization time for a reset operation is 1 millisecond. whenever a reset occurs during normal operation (that is, when both v dd and reset are high level), the reset pin is forced low and the reset operation starts. all system and peripheral control registers are then reset to their default hardware values (see table 8-1). in summary, the following sequence of events occurs during a reset operation: ? all interrupts are disabled. ? the watchdog function (basic timer) is enabled. ? ports 0-6 are set to schmitt trigger input mode and all pull-up resistors are disabled for the i/o port pin circuits. ? peripheral control and data registers are disabled an d reset to their default hardware values. ? the program counter (pc) is loaded with the program reset address in the rom, 0100h. ? when the programmed oscillation stabilization time interval has elapsed, the instruction stored in rom location 0100h (and 0101h) is fetched and executed. note to program the duration of the oscillation stabilization interval, you make the appropriate settings to the basic timer control register, btcon, before entering stop mode. also, if you do not want to use the basic timer watchdog function (which causes a system reset if a basic timer counter overflow occurs), you can disable it by writing '1010b' to the upper nibble of btcon.
reset and power-down s3c9234 /p9234 8- 2 power-down modes stop mode stop mode is invoked by the instruction stop. in stop mode, the operation of the cpu and main oscillator is halted. all peripherals which the main oscillator is selected as a clock source stop also because main oscillator stops. but the watch timer and lcd controller will not halted in stop mode if the sub clock is selected as watch timer clock source. the data stored in the internal register file are retained in stop mode. stop mode can be released in one of three ways: by a system reset, by an internal watch timer interrupt (when sub clock is selected as clock source of watch timer), or by an external interrupt. example: ld stopcon,#10100101b stop nop nop nop ld stopcon,#00000000b notes 1. do not use stop mode if you are using an external clock source because x in input must be restricted internally to v ss to reduce current leakage. 2. in application programs, a stop instruction must be immediately followed by at least three nop instructions. this ensures an adequate time interval for the clock to stabilize before the next instruction is executed. if three or more nop instructions are not used after stop instruction, leakage current could be flown because of the floating state in the internal bus. 3. to enable/disable stop instruction, the stopc on register should be written with 10100101b/other values before/after stop instruction. using reset to release stop mode stop mode is released when the reset signal goes active (low level): all system and peripheral control registers are reset to their default hardware values and the contents of all data registers are retained. when the programmed oscillation stabilization interval has elapsed, the cpu starts the system initialization routine by fetching the program instruction stored in rom location 0100h. using an external interrupt to release stop mode external interrupts can be used to release stop mode. for the s3c9234 microcontroller, we recommend using the int interrupt, p1 and p2.
s3c9234/p9234 reset and power-down 8- 3 using an internal interrupt to release stop mode an internal interrupt, watch timer, can be used to release stop mode because the watch timer operates in stop mode if the clock source of watch timer is sub clock. if system clock is sub clock, you can't use any interrupts to release stop mode. that is, you had better use the idle instruction instead of stop one when sub clock is selected as the system clock. please note the following conditions for stop mode release: ? if you release stop mode using an internal or external interrupt, the current values in system and peripheral control registers are unchanged. ? if you use an internal or external interrupt for stop mode release, you can also program the duration of the oscillation stabilization interval. to do this, you must make the appropriate control and clock settings before entering stop mode. ? if you use an interrupt to release stop mode, the bit-pair setting for clkcon.4/clkcon.3 remains unchanged and the currently selected clock value is used. ? the internal or external interrupt is serviced when the stop mode release occurs. following the iret from the service routine, the instruction immediately following the one that initiated stop mode is executed. idle mode idle mode is invoked by the instruction idle (opcode 6fh). in idle mode, cpu operations are halted while some peripherals remain active. during idle mode, the internal clock signal is gated away from the cpu and from all but the following peripherals, which remain active: ? interrupt logic ? basic timer ? timer 1 (timer a and b) ? watch timer ? lcd controller i/o port pins retain the mode (input or output) they had at the time idle mode was entered. idle mode release you can release idle mode in one of two ways: 1. execute a reset. all system and peripheral control registers are rese t to their default values and the contents of all data registers are retained. the reset automatically selects the slowest clock (1/16) because of the hardware reset value for the clkcon register. if all external interrupts are masked in the imr register, a reset is the only way you can release idle mode. 2. activate any enabled interrupt ? internal or external. when you use an interrupt to release idle mode, the 2 -bit clkcon.4/clkcon.3 value remains unchanged, and the currently selected clock value is used. the interrupt is then serviced. when the return-from-interrupt condition (iret) occurs, the instruction immediately following the one which initiated idle mode is executed.
reset and power-down s3c9234 /p9234 8- 4 hardware reset values table 8-1 list the values for cpu and system registers, peripheral control registers, and peripheral data registers following a reset operation in normal operating mode. the following notation is used in these table to represent specific reset values: ? a "1" or a "0" show s the reset bit value as logic one or logic zero, respectively. ? an 'x' means that the bit value is undefined following reset . ? a dash ('?') means that the bit is either not used or not mapped. table 8-1. register values after reset register name mnemonic address bit values after reset dec hex 7 6 5 4 3 2 1 0 sio control register siocon 208 d0h 0 0 0 0 0 0 0 0 sio data register siodata 209 d1h 0 0 0 0 0 0 0 0 sio prescaler register siops 210 d2h 0 0 0 0 0 0 0 0 oscillator control register osccon 211 d3h ? ? ? ? 0 0 ? 0 system clock control register clkcon 212 d4h 0 0 0 0 0 0 0 0 system flags register flags 213 d5h x x x x ? ? ? ? stop control register stpcon 214 d6h 0 0 0 0 0 0 0 0 lcd control register lcon 215 d7h 0 0 0 0 0 0 ? 0 interrupt pending register intpnd 216 d8h 0 0 0 0 ? 0 0 0 stack pointer sp 217 d9h x x x x x x x x watch timer control register wtcon 218 dah 0 0 0 0 0 0 0 0 locations dbh is not mapped. basic timer control register btcon 220 dch 0 0 0 0 0 0 0 0 basic timer counter btcnt 221 ddh x x x x x x x x locations deh is not mapped. system mode register sym 223 dfh x x x x 0 0 0 0 port 0 data register p0 224 e0h 0 0 0 0 0 0 0 0 port 1 data register p1 225 e1h 0 0 0 0 0 0 0 0 port 2 data register p2 226 e2h 0 0 0 0 0 0 0 0 port 3 data register p3 227 e3h 0 0 0 0 0 0 0 0 port 4 data register p4 228 e4h 0 0 0 0 0 0 0 0 port 5 data register p5 229 e5h 0 0 0 0 0 0 0 0 port 6 data register p6 230 e6h 0 0 0 0 0 0 0 0
s3c9234/p9234 reset and power-down 8- 5 table 8-1. register values after reset (continued) register name mnemonic address bit values after reset dec hex 7 6 5 4 3 2 1 0 timer a counter tacnt 231 e7h 0 0 0 0 0 0 0 0 timer b counter tbcnt 232 e8h 0 0 0 0 0 0 0 0 timer a data register tadata 233 e9h 1 1 1 1 1 1 1 1 timer b data register tbdata 234 eah 1 1 1 1 1 1 1 1 timer 1/a control register tacon 235 ebh 0 0 0 0 0 0 0 0 timer b control register tbcon 236 ech ? 0 0 0 0 0 0 0 port 0 control register p0con 237 edh 0 0 0 0 0 0 0 0 port 1 control register(high byte) p1conh 238 eeh 0 0 0 0 0 0 0 0 port 1 control register(low byte) p1conl 239 efh 0 0 0 0 0 0 0 0 port 1 pull-up resistor enable register p1pur 240 f0h 0 0 0 0 0 0 0 0 port 1 interrupt control register p1int 241 f1h ? ? 0 0 0 0 0 0 port 2 control register(high byte) p2conh 242 f2h 0 0 0 0 0 0 0 0 port 2 control register(low byte) p2conl 243 f3h 0 0 0 0 0 0 0 0 port 2 pull-up resistor enable register p2pur 244 f4h 0 0 0 0 0 0 0 0 port 2 interrupt control register p2int 245 f5h 0 0 0 0 0 0 0 0 port 3 control register(high byte) p3conh 246 f6h 0 0 0 0 0 0 0 0 port 3 control register(low byte) p3conl 247 f7h 0 0 0 0 0 0 0 0 port 3 pull-up resistor enable register p3pur 248 f8h 0 0 0 0 0 0 0 0 port 4 control register(high byte) p4conh 249 f9h 0 0 0 0 0 0 0 0 port 4 control register(low byte) p4conl 250 fah 0 0 0 0 0 0 0 0 port 5 control register(high byte) p5conh 251 fbh 0 0 0 0 0 0 0 0 port 5 control register(low byte) p5conl 252 fch 0 0 0 0 0 0 0 0 port 6 control register p6con 253 fdh 0 0 0 0 0 0 0 0 clock output control register clocon 254 feh ? ? ? ? ? ? 0 0 location ffh is not mapped.
reset and power-down s3c9234 /p9234 8- 6 notes
s3c9234/p9234 i/o p orts 9- 1 9 i/o ports overview the s3c9234/p9234 microcontroller has seven bit-programmable i/o ports, p0-p6. port 0 is 4-bit, port 1-port 6 are 8- bit ports. this gives a total of 52 i/o pins. each port can be flexibly configured to meet application design requirements. the cpu accesses ports by directly writing or reading port registers. no special i/o instructions are required. all ports of the s3c9234/p9234 can be configured to input or output mode. p0 and p3-p6 are shared with lcd signals. table 9-1 gives you a general overview of s3c9234/p9234 i/o port functions. table 9-1. s3c9234/p9234 port configuration overview port configuration options 0 1-bit programmable i/o port. input or push-pull output and software assignable pull-ups. p0.0-p0.3 can alternately used as outputs for lcd common signals. 1 1-bit programmable i/o port. schmitt trigger input or push-pull, open-drain output and software assignable pull-ups. alternatively p1.0-p1.2 can be used as input for external interrupts int and p1.3-p1.7 can be used as t1clk, taout, tbout, clkout, buz. 2 1-bit programmable i/o port. schmitt trigger input or push-pull, open-drain output and software assignable pull-ups. alternatively p2.4-p2.7 can be used as input for external interrupts int and p2.0-p2.2 can be used as sck, so, and si. 3 1-bit programmable i/o port. input or push-pull, open-drain output and software assignable pull-ups. alternatively p3 can be used as outputs for lcd segment signals. 4 1-bit programmable i/o port. input or push-pull output and software assignable pull-ups. alternatively p4 can be used as outputs for lcd segment signals. 5 1-bit programmable i/o port. input or push-pull output and software assignable pull-ups. alternatively p5 can be used as outputs for lcd segment signals. 6 2-bit programmable i/o port. input or push-pull output and software assignable pull-ups. alternatively p6 can be used as outputs for lcd segment signals.
i/o ports s3c9234/p 9234 9- 2 port data registers table 9-2 gives you an overview of the register locations of all seven s3c9234/p9234 i/o port data registers. data registers for ports 0, 1, 2, 3, 4, 5, and 6 have the general format shown in figure 9-1. table 9-2. port data register summary register name mnemonic decimal hex r/w port 0 data register p0 224 e0h r/w port 1 data register p1 225 e1h r/w port 2 data register p2 226 e2h r/w port 3 data register p3 227 e3h r/w port 4 data register p4 228 e4h r/w port 5 data register p5 229 e5h r/w port 6 data register p6 230 e6h r/w msb s3c9234/p9234 i/o port data register format (n = 0-6) .7 .6 .5 .4 .3 .2 .1 .0 lsb pn.7 pn.6 pn.5 pn.4 pn.3 pn.2 pn.1 pn.0 figure 9-1. s3c9234/p9234 i/o port data register format
s3c9234/p9234 i/o p orts 9- 3 port 0 port 0 is an 4-bit i/o port with individually configurable pins. port 0 pins are accessed directly by writing or reading the port 0 data register, p0 at location e0h in page 0. p0.0-p0.3 can serve as inputs (with or without pull-up), as push-pull output. you can be configured the following alternative functions. ? low-nibble pins (p0.0-p0.3): com0-com3 port 0 control register (p0con) port 0 has a 8-bit control register: p0con for p0.0-p0.3. a reset clears the p0con register to "00h", configuring pins to input mode. you use control register setting to select input (with or without pull-up) or push-pull output mode and enable the alternative functions. when programming this port, please remember that any alternative peripheral i/o function you configure using the port 0 control register must also be enabled in the associated peripheral module. port 0 control register (p0con) edh, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p0.3/com3 p0con bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (cpm3-com0) p0.2/com2 p0.1/com1 p0.0/com0 input with pull-up resistor input mode figure 9-2. port 0 control register (p0con)
i/o ports s3c9234/p 9234 9- 4 port 1 port 1 is an 8-bit i/o port with individually configurable pins. port 1 pins are accessed directly by writing or reading the port 1 data register, p1 at location e1h in page 0. p1.0-p1.7 can serve as inputs (with or without pull-up), as outputs (push-pull or open-drain) or you can be configured the following functions. ? low-nibble pins (p1.0-p1.3): int, t1clk ? high-nibble pins (p1.4-p1.7): taout, tbout, clkout, buz port 1 control register (p1conh, p1conl) port 1 has two 8-bit control register: p1conh for p1.4-p1.7 and p1conl for p1.0-p1.3. a reset clears the p1conh and p1conl register to "00h", configuring p1.0-p1.2 pins to input mode with interrupt and p1.3-p1.7 input mode. you use control register setting to select input or output mode (push-pull or open-drain) and enable the alternative functions. when programming this port, please remember that any alternative peripheral i/o function you configure using the port 1 control register must also be enabled in the associated peripheral module. port 1 pull-up resistor control register (p1pur) using the port 1 pull-up resistor control register, p1pur (f0h, page 0), you can configure pull-up resistors to individual port 1 pins. port 1 interrupt control registers (p1int, intpnd.2-.0) to process external interrupts at the port 1 pins, two additional control registers are provided: the port 1 interrupt control register p1int (f1h, page 0), the port 1 interrupt pending bits intpnd.2-.0 (d8h, page 0). the port 1 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending condition when the interrupt service routine has been initiated. the application program detects interrupt requests by polling the intpnd.2-.0 register at regular intervals. when the interrupt enable bit of any port 1 pin is "1", a rising or falling edge at that pin will generate an interrupt request. the corresponding intpnd bit is then automatically set to "1" and the irq level goes low to signal the cpu that an interrupt request is waiting. when the cpu acknowledges the interrupt request, application software must the clear the pending condition by writing a "0" to the corresponding intpnd bit.
s3c9234/p9234 i/o p orts 9- 5 port 1 control register, high byte (p1conh) eeh, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p1.7/buz p1conh bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (buz, clkout, tbout, taout) p1.6/clkout p1.5/tbout p1.4/taout n-channel open-drain output mode schmitt trigger input mode figure 9-3. port 1 high-byte control register (p1conh) port 1 control register, low byte (p1conl) efh, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p1.3/t1clk p1conl bit-pair pin configuration settings: 00 01 10 11 not available p1.2/int p1.1/int p1.0/int schmitt trigger input mode (t1clk) n-channel open-drain output mode push-pull output mode figure 9-4. port 1 low-byte control register (p1conl)
i/o ports s3c9234/p 9234 9- 6 port 1 pull-up control register (p1pur) f0h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p1pur bit configuration settings: 0 1 enable pull-up resistor disable pull-up resistor p1.3 p1.2 p1.1 p1.0 p1.7 p1.6 p1.5 p1.4 note: a pull-up resistor of port1 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function. figure 9-5. port 1 pull-up control register (p1pur) port 1 interrupt control register (p1int) f1h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb not used p1int bit configuration settings: 00 01 enable interrupt by falling edge disable interrupt 10 11 enable interrupt by both falling and rising edge enable interrupt by rising edge p1.2 (int) p1.1 (int) p1.0 (int) figure 9-6. port 1 interrupt control register (p1int)
s3c9234/p9234 i/o p orts 9- 7 port 1 interrupt pending bits (intpnd.2-.0) d8h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb intpnd bit configuration settings: 0 1 not used interrupt is pending (when read) no interrupt pending (when read), clear pending bit (when write) p1.2 (int) p1.1 (int) p1.0 (int) p2.7 (int) p2.6 (int) p2.5 (int) p2.4 (int) figure 9-7. port 1 interrupt pending bits (intpnd.2-.0)
i/o ports s3c9234/p 9234 9- 8 port 2 port 2 is an 8-bit i/o port with individually configurable pins. port 2 pins are accessed directly by writing or reading the port 2 data register, p2 at location e2h in page 0. p2.0-p2.7 can serve as inputs (with or without pull-up), as outputs (push-pull or open-drain) or you can be configured the following functions. ? low-nibble pins (p2.0-p2.3): sck, so, si ? high-nibble pins (p2.4-p2.7): int port 2 control register (p2conh, p2conl) port 2 has two 8-bit control register: p2conh for p2.4-p2.7 and p2conl for p2.0-p2.3. a reset clears the p2conh/p2conl register to "00h", configuring p2.4-p2.7 pins to input mode with interrupt and p2.0-p2.3 input mode. you use control register setting to select input or output mode (push-pull or open-drain) and enable the alternative functions. when programming this port, please remember that any alternative peripheral i/o function you configure using the port 2 control register must also be enabled in the associated peripheral module. port 2 pull-up resistor control register (p2pur) using the port 2 pull-up resistor control register, p2pur (f4h, page 0), you can configure pull-up resistors to individual port 2 pins. port 2 interrupt control registers (p2int, intpnd.4-.7) to process external interrupts at the port 2 pins, two additional control registers are provided: the port 2 interrupt control register p2int (f5h, page 0), the port 2 interrupt pending bits intpnd.4-.7 (d8h, page 0). the port 2 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending condition when the interrupt service routine has been initiated. the application program detects interrupt requests by polling the intpnd.4-.7 register at regular intervals. when the interrupt enable bit of any port 2 pin is "1", a rising or falling edge at that pin will generate an interrupt request. the corresponding intpnd bit is then automatically set to "1" and the irq level goes low to signal the cpu that an interrupt request is waiting. when the cpu acknowledges the interrupt request, application software must the clear the pending condition by writing a "0" to the corresponding intpnd bit.
s3c9234/p9234 i/o p orts 9- 9 port 2 control register, high byte (p2conh) f2h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p2.7 (int) p2conh bit-pair pin configuration settings: 00 01 10 11 not available p2.6 (int) p2.5 (int) p2.4 (int) schmitt trigger input mode n-channel open-drain output mode push-pull output mode figure 9-8. port 2 high-byte control register (p2conh) port 2 control register, low byte (p2conl) f3h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p2.3 p2conl bit-pair pin configuration settings: 00 01 10 11 alternative function (sck, so) p2.2/si p2.1/so p2.0/sck schmitt trigger input mode (si,sck) n-channel open-drain output mode push-pull output mode figure 9-9. port 2 low-byte control register (p2conl)
i/o ports s3c9234/p 9234 9- 10 port 2 pull-up control register (p2pur) f4h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p2pur bit configuration settings: 0 1 enable pull-up resistor disable pull-up resistor p2.3 p2.2 p2.1 p2.0 p2.7 p2.6 p2.5 p2.4 note: a pull-up resistor of port2 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function. figure 9-10. port 2 pull-up control register (p2pur)
s3c9234/p9234 i/o p orts 9- 11 port 2 interrupt control register (p2int) f5h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb int bit configuration settings: 0 1 enable interrupt disable interrupt edg int edg int edg int edg int edg bit configuration settings: 0 1 select rising edge select falling edge figure 9-11. port 2 interrupt control register (p2int) port 2 interrupt pending bits (intpnd.7-.4) d8h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb intpnd bit configuration settings: 0 1 not used interrupt is pending (when read) no interrupt pending (when read), clear pending bit (when write) p1.2 (int) p1.1 (int) p1.0 (int) p2.7 (int) p2.6 (int) p2.5 (int) p2.4 (int) figure 9-12. port 2 interrupt pending bits (intpnd.7-.4)
i/o ports s3c9234/p 9234 9- 12 port 3 port 3 is an 8-bit i/o port with individually configurable pins. port 3 pins are accessed directly by writing or reading the port 3 data register, p3 at location e3h in page 0. p3.0-p3.7 can serve as inputs (with or without pull-up), as outputs (push-pull or open-drain) or you can be configured the following functions. ? low-nibble pins (p3.0-p3.3): seg31-seg28 ? high-nibble pins (p3.4-p3.7): seg27-seg24 port 3 control register (p3conh, p3conl) port 3 has two 8-bit control register: p3conh for p3.4-p3.7 and p3conl for p3.0-p3.1. a reset clears the p3con register to "00h", configuring all pins to input mode. you use control register setting to select input or output mode (push-pull or open-drain). when programming this port, please remember that any alternative peripheral i/o function you configure using the port 3 control register must also be enabled in the associated peripheral module. port 3 pull-up resistor control register (p3pur) using the port 3 pull-up resistor control register, p3pur (f8h, page 0), you can configure pull-up resistors to individually port 3 pins. port 3 control register, high byte (p3conh) f6h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p3.5/seg26 p3.4/seg27 p3conh bit-pair pin configuration settings: 00 01 10 11 alternative fumction (seg24-seg27) input mode n-channel open-drain output mode push-pull output mode p3.6/seg25 p3.7/seg24 figure 9-13. port 3 high byte control register (p3conh)
s3c9234/p9234 i/o p orts 9- 13 port 3 control register, low byte (p3conl) f7h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p3.1/seg30 p3.0/seg31 p3conl bit-pair pin configuration settings: 00 01 10 11 alternative function (seg28-seg31) input mode n-channel open-drain output mode push-pull output mode p3.3/seg28 p3.2/seg29 figure 9-14. port 3 low byte control register (p3conl) port 3 pull-up control register (p3pur) f8h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p3pur bit configuration settings: 0 1 enable pull-up resistor disable pull-up resistor p3.1 p3.0 p3.3 p3.2 p3.5 p3.4 p3.7 p3.6 note: a pull-up resistor of port3 is automatically disabled when the corresponding pin is selected as push-pull output or alternative function. figure 9-15. port 3 pull-up control register (p3pur)
i/o ports s3c9234/p 9234 9- 14 port 4 port 4 is an 8-bit i/o port with individually configurable pins. port 4 pins are accessed directly by writing or reading the port 4 data register, p4 at location e4h in page 0. p4.0-p4.7 can serve as inputs (with or without pull-up), as push-pull outputs: ? low-nibble pins (p4.0-p4.3): seg23-seg20 ? high-nibble pins (p4.4-p4.7): seg19-seg16 port 4 control registers (p4conh, p4conl) port 4 has two 8-bit control registers: p4conh for p4.4-p4.7 and p4conl for p4.0-p4.3. a reset clears the p4conh and p4conl registers to "00h", configuring all pins to input mode. you use control registers setting to select input or output mode. port 3 control register, high byte (p4conh) f9h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p4.5/seg18 p4.4/seg19 p4conh bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (seg16-seg19) input with pull-up resistor input mode p4.7/seg16 p4.6/seg17 figure 9-16. port 4 high-byte control register (p4conh) port 4 control register, low byte (p4conl) fah, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p4.1/seg22 p4.0/seg23 p4conh bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (seg20-seg23) input with pull-up resistor input mode p4.2/seg21 p4.3/seg20 figure 9-17. port 4 low-byte control register (p4conl)
s3c9234/p9234 i/o p orts 9- 15 port 5 port 5 is an 8-bit i/o port with individually configurable pins. port 5 pins are accessed directly by writing or reading the port 5 data register, p5 at location e5h in page 0. p5.0-p5.7 can serve as inputs (with or without pull-up), as push-pull outputs. ? low-nibble pins (p5.0-p5.3): seg15-seg12 ? high-nibble pins (p5.4-p5.7): seg11-seg8 port 5 control registers (p5conh, p5conl) port 5 has two 8-bit control registers: p5conh for p5.4-p5.7 and p5conl for p5.0-p5.3. a reset clears the p5conh and p5conl registers to "00h", configuring all pins to input mode. you use control registers setting to select input or output mode. port 5 control register, high byte (p5conh) fbh, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p5.5/seg10 p5.4/seg11 p5conh bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (seg8-seg11) input with pull-up resistor input mode p5.6/seg9 p5.7/seg8 figure 9-18. port 5 high-byte control register (p5conh) port 5 control register, low byte (p5conl) fch, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p5.1/seg14 p5.0/seg15 p5conl bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (seg12-seg15) input with pull-up resistor input mode p5.2/seg13 p5.3/seg12 figure 9-19. port 5 low-byte control register (p5conl)
i/o ports s3c9234/p 9234 9- 16 port 6 port 6 is an 8-bit i/o port with bit-pair configurable pins. port 6 pins are accessed directly by writing or reading the port 6 data register, p6 at location e6h in page 0. p6.0-p6.7 can serve as inputs or as push-pull outputs: ? low-nibble pins (p6.0-p6.3): seg7-seg4 ? high-nibble pins (p6.4-p6.7): seg3-seg0 port 6 control register (p6con) port 6 has a 8-bit control register: p6con for p6.0-p6.7. a reset clears the p6con registers to "00h", configuring all pins to input mode. you use control registers setting to select input or output mode. port 6 control register (p6con) fdh, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb p6.3-p6.2/ seg4-seg5 p6.1-p6.0/ seg6-seg7 p6con bit-pair pin configuration settings: 00 01 10 11 push-pull output mode alternative function (seg0-seg7) input with pull-up resistor input mode p6.5-p6.4/ seg2-seg3 p6.7-p6.6/ seg0-seg1 figure 9-20. port 6 control register (p6con)
s3c9234/p9234 basic timer 10- 1 10 basic timer overview basic timer (bt) can be used in two different ways: ? as a watchdog timer to provide an automatic reset mechanism in the event of a system malfunction. ? to signal the end of the required oscillation stabilization interval after a reset or a stop mode release. the functional components of the basic timer block are: ? clock frequency divider (f xx divided by 4096, 1024, 128, or 16) with multiplexer ? 8-bit basic timer counter, btcnt (ddh, read-only) ? basic timer control register, btcon (dch, read/write)
basic timer s3c9234 /p9234 10- 2 basic timer control register (btcon) the basic timer control register, btcon, is used to select the input clock frequency, to clear the basic timer counter and frequency dividers, and to enable or disable the watchdog timer function. it is located in page 0, address dch, and is read/write addressable using register addressing mode. a reset clears btcon to "00h". this enables the watchdog function and selects a basic timer clock frequency of f xx /4096. to disable the watchdog function, you must write the signature code "1010b" to the basic timer register control bits btcon.7?btcon.4. the 8-bit basic timer counter, btcnt (page 0, ddh), can be cleared at any time during normal operation by writing a "1" to btcon.1. to clear the frequency dividers for the basic timer input clock and timer counters, you write a "1" to btcon.0. basic timer control register (btcon) dch, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb divider clear bit for basic timer and timer counters: 0 = no effect 1 = clear divider basic timer counter clear bit: 0 = no effect 1 = clear btcnt basic timer input clock selection bits: 00 = f xx /4096 01 = f xx /1024 10 = f xx /128 11 = f xx /16 watchdog function enable bits: 1010b other value = disable watchdog timer = enable watchdog timer figure 10-1. basic timer control register (btcon)
s3c9234/p9234 basic timer 10- 3 basic timer function description watchdog timer function you can program the basic timer overflow signal (btovf) to generate a reset by setting btcon.7?btcon.4 to any value other than "1010b". (the "1010b" value disables the watchdog function.) a reset clears btcon to "00h", automatically enabling the watchdog timer function. a reset also selects the cpu clock (as determined by the current clkcon register setting), divided by 4096, as the bt clock. a reset whenever a basic timer counter overflow occurs. during normal operation, the application program must prevent the overflow, and the accompanying reset operation, from occurring. to do this, the btcnt value must be cleared (by writing a "1" to btcon.1) at regular intervals. if a system malfunction occurs due to circuit noise or some other error condition, the bt counter clear operation will not be executed and a basic timer overflow will occur, initiating a reset. in other words, during normal operation, the basic timer overflow loop (a bit 7 overflow of the 8-bit basic timer counter, btcnt) is always broken by a btcnt clear instruction. if a malfunction does occur, a reset is triggered automatically. oscillation stabilization interval timer function you can also use the basic timer to program a specific oscillation stabilization interval following a reset or when stop mode has been released by an external interrupt. in stop mode, whenever a reset or an internal and an external interrupt occurs, the oscillator starts. the btcnt value then starts increasing at the rate of fxx/4096 (for reset), or at the rate of the preset clock source (for an internal and an external interrupt). when btcnt.3 overflows, a signal is generated to indicate that the stabilization interval has elapsed and to gate the clock signal off to the cpu so that it can resume normal operation. in summary, the following events occur when stop mode is released: 1. during stop mode, a power-on reset or an internal and an external interrupt occurs to trigger the stop mode release and oscillation starts. 2. if a power-on reset occurred, the basic timer counter will increase at the rate of fx x /4096. if an internal and an external interrupt is used to release stop mode, the btcnt value increases at the rate of the preset clock source. 3. clock oscillation stabilization interval begins and continues until bit 3 of the basic timer coun ter overflows. 4. when a btcnt.3 overflow occurs, normal cpu operation resumes.
basic timer s3c9234 /p9234 10- 4 note: during a power-on reset operation, the cpu is idle during the required oscillation stabilization interval (until bit 4 of the basic timer counter overflows). mux f xx /4096 div f xx /1024 f xx /128 f xx /16 f xx bits 3, 2 bit 0 basic timer control register (write '1010xxxxb' to disable) clear bit 1 reset or stop data bus 8-bit up counter (btcnt, read-only) start the cpu (note) ovf reset r figure 10-2. basic timer block diagram
s3c9234/p9234 timer 1 11- 1 11 timer 1 one 16-bit timer mode (timer 1) the 16-bit timer 1 is used in one 16-bit timer or two 8-bit timers mode. if tacon.7 is set to "1", timer 1 is used as a 16-bit timer. if tacon.7 is set to "0", timer 1 is used as two 8-bit timers. ? one 16-bit tim er mode (timer 1) ? two 8-bit timers mode (timer a and b) overview the 16-bit timer 1 is an 16-bit general-purpose timer. timer 1 has the interval timer mode by using the appropriate tacon setting. timer 1 has the following functional components: ? clock frequency divider (fxx divided by 512, 256, 64, 8, or 1, fxt, and t1clk: external clock) with multiplexer ? 16-bit counter (tacnt, tbcnt), 16-bit comparator, and 16-bit reference data register (tadata, tbdata) ? timer 1 match interrupt generation ? timer 1 control register, tacon (page 0, ebh, read/write) function description interval timer function the timer 1 module can generate an interrupt: the timer 1 match interrupt (t1int). the t1int pending condition should be cleared by software when it has been serviced. even though t1int is disabled, the application's service routine can detect a pending condition of t1int by the software and execute it's sub-routine. when this case is used, the t1int pending bit must be cleared by the application sub-routine by writing a "0" to the tacon.0 pending bit. in interval timer mode, a match signal is generated when the counter value is identical to the values written to the timer 1 reference data registers, tadata and tbdata. the match signal generates a timer 1 match interrupt and clears the counter. if, for example, you write the value 32h and 10h to tadata and tbdata, respectively, and 8eh to tacon, the counter will increment until it reaches 3210h. at this point, the timer 1 interrupt request is generated, the counter value is reset, and counting resumes.
timer 1 s3c9234/p923 4 11- 2 timer 1 control register (tacon) you use the timer 1 control register, tacon, to ? enable the timer 1 operating (interval timer) ? select the timer 1 input clock frequency ? clear the timer 1 counter, tacnt and tbcnt ? enable the timer 1 interrupt tacon is located in page 0, at address ebh, and is read/write addressable using register addressing mode. a reset clears tacon to "00h". this sets timer 1 to disable interval timer mode, selects an input clock frequency of fxx/512, and disables timer 1 interrupt. you can clear the timer 1 counter at any time during normal operation by writing a "1" to tacon.3. to enable the timer 1 interrupt, you must write tacon.7, tacon.2, and tacon.1 to "1". to generate the exact time interval, you should write tacon.3 and tacon.0 to "10b", which cleared counter and interrupt pending bit. to detect an interrupt pending condition when t1int is disabled, the application program polls pending bit, tacon.0. when a "1" is detected, a timer 1 interrupt is pending. when the t1int sub-routine has been serviced, the pending condition must be cleared by software by writing a "0" to the timer 1 interrupt pending bit, tacon.0. timer a control register (tacon) ebh, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb timer 1/a interrupt enable bit: 0 = disable interrupt 1 = enable interrupt timer 1 interrupt pending bit: 0 = no interrupt pending (when read) clear pending bit (when write) 1 = interrupt is pending (when read) no effect (when write) timer 1/a counter enable bit: 0 = disable counting operation 1 = enable counting operation timer 1/a counter clear bit: 0 = no affect 1 = clear the timer 1/a counter (when write) one 16-bit timer or two 8-bit timers mode: 0 = two 8-bit timers mode (timer a/b) 1 = one 16-bit timer mode (timer 1) timer 1/a clock selection bits: 000 = fxx/512 001 = fxx/256 010 = fxx/64 011 = fxx/8 100 = fxx 101 = fxt (sub clock) 110 = t1clk (external clock) 111 = not available figure 11-1. timer 1 control register (tacon)
s3c9234/p9234 timer 1 11- 3 note: when one 16-bit timer mode (tacon.7 <- "1": timer 1) tacon.6-.4 m u x 1/8 1 /64 1 /256 1 /512 tacon.0 taout t1int 1/1 div r fxt t1clk (x in or xt in ) fxx btcon.0 tacon.2 tbcnt tacnt 16-bit comparator tbdata buffer tadata buffer tbdata tadata lsb msb lsb msb match signal t1clr tacon.1 match r tacon.3 data bus data bus clear figure 11-2. timer 1 block diagram (one 16-bit mode)
timer 1 s3c9234/p923 4 11- 4 two 8-bit timers mode (timer a and b) overview the 8-bit timer a and b are the 8-bit general-purpose timers. timer a and b have the interval timer mode by using the appropriate tacon and tbcon setting, respectively. timer a and b have the following functional components: ? clock frequency divider with multiplexer ? fxx divided by 512, 256, 64, 8 or 1, fxt, and t1clk (external clock) for timer a ? fxx divided by 512, 256, 64 or 8 and fxt for timer b ? 8-bit counter (tacnt, tbcnt), 8-bit comparator, and 8-bit reference data register (tadata, tbdata) ? timer a have i/o pin for match output (taout) ? timer a match interrupt generation ? timer a control register, tacon (page 0, ebh, read/write) ? timer b have i/o pin for match output (tbout) ? timer b match interrupt generation ? timer b control register, tbcon (page 0, ech, read/write) timer a and b control register (tacon, tbcon) you use the timer a and b control register, tacon and tbcon, to ? enable the timer a (interval timer mode) and b operating (interval timer mode) ? select the timer a and b input clock frequency ? clear the timer a and b counter, tacnt and tbcnt ? enable the timer a and b interrupt
s3c9234/p9234 timer 1 11- 5 tacon and tbcon are located in page 0, at address ebh and ech, and is read/write addressable using register addressing mode. a reset clears tacon to "00h". this sets timer a to disable interval timer mode, selects an input clock frequency of fxx/512, and disables timer a interrupt. you can clear the timer a counter at any time during normal operation by writing a "1" to tacon.3. a reset clears tbcon to "00h". this sets timer b to disable interval timer mode, selects an input clock frequency of fxx/512, and disables timer a interrupt. you can clear the timer b counter at any time during normal operation by writing a "1" to tbcon.3. to enable the timer a interrupt (taint) and timer b interrupt (tbint), you must write tacon.7 to "0", tacon.2 (tbcon.2) and tacon.1 (tbcon.1) to "1". to generate the exact time interval, you should write tacon.3 (tbcon.3) and tacon.0 (tbcon.0), which cleared counter and interrupt pending bit. to detect an interrupt pending condition when taint and tbint is disabled, the application program polls pending bit, tacon.0 and tbcon.0. when a "1" is detected, a timer a interrupt (taint) and timer b interrupt (tbint) is pending. when the taint and tbint sub-routine has been serviced, the pending condition must be cleared by software by writing a "0" to the timer a and b interrupt pending bit, tacon.0 and tbcon.0. timer a control register (tacon) ebh, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb timer a interrupt enable bit: 0 = disable interrupt 1 = enable interrupt timer a interrupt pending bit: 0 = no interrupt pending (when read) clear pending bit (when write) 1 = interrupt is pending (when read) no effect (when write) timer a counter enable bit: 0 = disable counting operation 1 = enable counting operation timer a counter clear bit: 0 = no affect 1 = clear the timer 1/a counter (when write) one 16-bit timer or two 8-bit timers mode: 0 = two 8-bit timers mode (timer a/b) 1 = one 16-bit timer mode (timer 1) timer 1/a clock selection bits: 000 = fxx/512 001 = fxx/256 010 = fxx/64 011 = fxx/8 100 = fxx 101 = fxt (sub clock) 110 = t1clk (external clock) 111 = not available figure 11-3. timer a control register (tacon)
timer 1 s3c9234/p923 4 11- 6 timer b control register (tbcon) ech, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb timer b match interrupt enable bit: 0 = disable match interrupt 1 = enable match interrupt timer b interrupt pending bits: 0 = no interrupt pending (when read) clear pending bit (when write) 1 = interrupt is pending (when read) no effect (when write) timer b count enable bit: 0 = disable counting operating 1 = enable counting operating timer b counter clear bit: 0 = no effect 1 = clear the timer b counter (when write) not used timer b clock selection bits: 000 = fxx/512 001 = fxx/256 010 = fxx/64 011 = fxx/8 100 = fxt (sub clock) figure 11-4. timer b control register (tbcon)
s3c9234/p9234 timer 1 11- 7 function description interval timer function (timer a and timer b) the timer a and b module can generate an interrupt: the timer a match interrupt (taint) and the timer b match interrupt (tbint). the timer a match interrupt pending condition (tacon.0) and the timer b match interrupt pending condition (tbcon.0) must be cleared by software in the application's interrupt service by means of writing a "0" to the tacon.0 and tbcon.0 interrupt pending bit. even though taint and tbint are disabled, the application's service routine can detect a pending condition of taint and tbint by the software and execute it's sub-routine. when this case is used, the taint and tbint pending bit must be cleared by the application sub-routine by writing a "0" to the corresponding pending bit tacon.0 and tbcon.0. in interval timer mode, a match signal is generated when the counter value is identical to the values written to the timer a or timer b reference data registers, tadata or tbdata. the match signal generates corresponding match interrupt and clears the counter. if, for example, you write the value 20h to tadata and 0eh to tacon, the counter will increment until it reaches 20h. at this point, the timer a interrupt request is generated, the counter value is cleared, and counting resumes and you write the value 10h to tbdata, "0" to tacon.7, and 0eh to tbcon, the counter will increment until it reaches 10h. at this point, tb interrupt request is generated, the counter value is cleared and counting resumes.
timer 1 s3c9234/p923 4 11- 8 note: when two 8-bit timers mode (tacon.7 <- "0": timer a) tacon.6-.4 m u x 1/8 1 /64 1 /256 1 /512 tacon.0 taout taint div r fxt t1clk (x in or xt in ) fxx btcon.0 tacon.2 8-bit comparator tadata buffer tadata register lsb msb lsb msb match signal taclr tacon.1 match r tacon.3 data bus data bus tacnt (8-bit up-counter) clear 1/1 figure 11-5. timer a block diagram(two 8-bit timers mode)
s3c9234/p9234 timer 1 11- 9 1/8 1 /64 1 /256 1 /512 note: when two 8-bit timers mode (tacon.7 <- "0": timer b) tbcon.6-.4 m u x tbcon.0 tbint div r fxt (x in or xt in ) fxx btcon.0 tbcon.2 8-bit comparator tbdata buffer tbdata register lsb msb lsb msb match signal tbclr tbcon.1 match r tbcon.3 data bus data bus tbcnt (8-bit up-counter) clear tbout figure 11-6. timer b block diagram (two 8-bit timers mode)
timer 1 s3c9234/p923 4 11- 10 notes
S3P9234 ( preliminary spec) watc h timer 12- 1 12 watch timer overview watch timer functions include real-time and watch-time measurement and interval timing for the system clock. to start watch timer operation, set bit 1 of the watch timer control register, wtcon.1 to "1". and if you want to service watch timer overflow interrupt, then set the wtcon.6 to "1". the watch timer overflow interrupt pending condition (wtcon.0) must be cleared by software in the application's interrupt service routine by means of writing a "0" to the wtcon.0 interrupt pending bit. after the watch timer starts and elapses a time, the watch timer interrupt pending bit (wtcon.0) is automatically set to "1", and interrupt requests commence in 3.91ms, 0.25, 0.5 and 1-second intervals by setting watch timer speed selection bits (wtcon.3 ? .2). the watch timer can generate a steady 0.5 khz, 1 khz, 2 khz, or 4 khz signal to buz output pin for buzzer. by setting wtcon.3 and wtcon.2 to "11b", the watch timer will function in high-speed mode, generating an interrupt every 3.91 ms. high-speed mode is useful for timing events for program debugging sequences. also, you can select watch timer clock source by setting the wtcon.7 appropriately value. the watch timer supplies the clock frequency for the lcd controller (f lcd ). therefore, if the watch timer is disabled, the lcd controller does not operate. watch timer has the following functional components: ? real time and watch-time measurement ? using a main or sub clock source (main clock divided by 2 7 (fx/128) or sub clock(fxt)) ? clock source generation for lcd controller (f lcd ) ? i/o pin for buzzer output frequency generator (p1.7, buz) ? timing tests in high-speed mode ? watch timer overflow interrupt generation ? watch timer control register, wtcon (page 0, dah, read/write)
watch timer s3p923 4 ( preliminary spec) 12- 2 watch timer control register (wtcon) the watch timer control register, wtcon is used to select the input clock source, the watch timer interrupt time and buzzer signal, to enable or disable the watch timer function. it is located in page 0 at address dah, and is read/write addressable using register addressing mode. a reset clears wtcon to "00h". this disable the watch timer and select fx/128 as the watch timer clock. so, if you want to use the watch timer, you must write appropriate value to wtcon. buzzer signal selection bits: 00 = 0.5 khz 01 = 1 khz 10 = 2 khz 11 = 4 khz watch timer control register (wtcon) dah, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb watch timer enable/disable bit: 0 = disable watch timer; clear frequency dividing circuits 1 = enable watch timer watch timer interrupt pending bits: 0 = no interrupt pending (when read) clear pending bit (when write) 1 = interrupt is pending (when read) no effect (when write) watch timer speed selection bits: 00 = set watch timer interrupt to 1 s 01 = set watch timer interrupt to 0.5 s 10 = set watch timer interrupt to 0.25 s 11 = set watch timer interrupt to 3.91 ms watch timer clock selection bit: 0 = main clock divided by 2 7 (fx/128) 1 = sub clock (fxt) watch timer int enable/disable bit: 0 = disable watch timer int 1 = enable watch timer int figure 12-1. watch timer control register (wtcon)
S3P9234 ( preliminary spec) watc h timer 12- 3 watch timer circuit diagram wt int enable wtcon.1 wtcon.2 wtcon.3 wtcon.4 wtcon.5 wtcon.6 enable/disable selector circuit mux wtcon.0 wtint wtcon.6 f w /2 15 f w /2 14 f w /2 13 f w /2 7 f w /64 (0.5 khz) f w /32 (1 khz) f w /16 (2 khz) f w /8 (4 khz) (1 hz) f x = main clock (where fx = 4.19 mhz) fxt = sub clock (32,768 hz) f w = watch timer frequency clock selector frequency dividing circuit f w 32.768 khz f xt f lcd = 2048 hz wtcon.7 wtcon.0 (pending bit) 8 buz (p1.7) fx/128 figure 12-2. watch timer circuit diagram
watch timer s3p923 4 ( preliminary spec) 12- 4 notes
s3c9234/p9234 lcd controller/driv er 13- 1 1 3 lcd controller/driv er overview the s3c9234/p9234 microcontroller can directly drive an up-to- 128 -dot ( 32 segments x 4 commons) lcd panel. its lcd block has the following components: ? lcd contro ller/driver ? display ram (b0h-bfh of page 0) for storing display data ? 32 segment output pins (seg0 ? seg 31 ) ? 4 common output pins (com0? com3 ) ? three lcd operating power supply pins (v lc0 -v lc2 ) ? bias pin for controlling the driver and bias voltage ? lcd bias by internal/external register bit setting in the lcd control register, lcon, determine the lcd frame, duty and bias. the lcd control register, lcon , is used to turn the lcd display on or off, to s elect lcd clock frequency, to select bias and duty, and switch the current to the dividing resistor for the lcd display . data written to the lcd display ram can be transferred to the segment signal pins automatically without program control. when a sub clock is selected as the lcd clock source, the lcd display is enabled even during main clock stop and idle modes. 8 data bus bias 1 seg0-seg31 32 com0-com3 4 v lc0 -v lc2 3 lcd controller/ driver figure 13- 1. lcd function diagram
lcd controller/driver s3c9234/p9234 13- 2 lcd circuit diagram data bus port latch lcon lcd display ram (0b0h-0bfh) seg/port driver lcd voltage controller seg0/p6.7 seg15/p5.0 seg16/p4.7 seg31/p3.0 com/port driver timing controller com2/p0.3 com1/p0.2 com0/p0.1 f lcd bias v lc0 v lc1 v lc2 figure 13- 2. lcd circuit diagram
s3c9234/p9234 lcd controller/driv er 13- 3 lcd ram address area ram addresses of page 0 are used as lcd data memory. when the bit value of a display segment is "1", the lcd display is turned on; when the bit value is "0", the display is turned off. display ram data are sent out through segment pins seg0?seg 31 using a direct memory access (dma) method that is synchronized with the f lcd signal. ram addresses in this location that are not used for lcd display can be allocated to general-purpose use. com0 com1 com2 com3 b0 b4 b0 b4 b0 b4 b0 b4 b0 b4 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 0b0h 0b1h 0b2h 0b3h 0b4h b0 b4 b0 b4 b0 b4 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 b1 b5 b2 b6 b3 b7 0bdh 0beh 0bfh seg0 seg1 seg2 seg3 seg4 seg5 seg6 seg7 seg8 seg9 seg26 seg27 seg28 seg29 seg30 seg31 figure 13- 3. lcd display data ram organization table 13- 1. lcd clock signal frame frequency lcdck frequency (f lcd ) static 1/2 duty 1/3 duty 1/4 duty 64 hz 64 32 21 16 128 hz 128 64 43 32 256hz 256 128 85 64 512 hz 512 256 171 128
lcd controller/driver s3c9234/p9234 13- 4 lcd control register (lcon) a lcon is located in page 0, at address d7h, and is read/write addressable using register addressing mode. it has the following control functions. ? lcd duty and bias selection ? lcd clock selection ? lcd display control ? internal/external lcd dividing resistors selection the lcon register is used to turn the lcd display on/off, to select duty and bias, to select lcd clock and control the flow of the current to the dividing in the lcd circuit. following a reset , all lcon values are cleared to "0". this turns off the lcd display, select 1/4 duty and 1/3 bias, select 64hz for lcd clock, and enable internal lcd dividing resistors. the lcd clock signal determines the frequency of com signal scanning of each segment output. this is also referred as the lcd frame frequency. since the lcd clock is generated by watch timer clock (fw). the watch timer should be enabled when the lcd display is turned on. lcd control register (lcon) d7h, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb internal lcd dividing register enable bits: 0 = enable internal lcd dividing resistors 1 = disable internal lcd dividing resistors not used lcd duty and bias selection bits: 000 = 1/4 duty, 1/3 bias 001 = 1/3 duty, 1/3 bias 010 = 1/3 duty, 1/2 bias 011 = 1/2 duty, 1/2 bias 1xx = static lcd display control bit: 0 = all lcd signals are low (turn off the r-tr) 1 = turn display on (turn on the p-tr) lcd clock selection bits: 00 = fw/2 9 (64 hz) 01 = fw/2 8 (128 hz) 10 = fw/2 7 (256 hz) 11 = fw/2 6 (512 hz) figure 13-4. lcd control register (lcon)
s3c9234/p9234 lcd controller/driv er 13- 5 lcd voltage dividing resistor notes: 1. r = internal lcd dividing resistors. the resistors can be disconnected by lcon.7. 2. r' = external lcd dividing resistors. 3. r'' = external resistor to adjust v lcd . s3c9234 bias lcon.0 v lc0 v lc2 v lc1 v ss v dd 2r r r r v lcd lcon.7 = 0: enable internal resistors static and 1/3 bias (v lcd = 3v at v dd = 5v) 1/2 bias (v lcd = 2.5v at v dd = 5v) s3c9234 bias lcon.0 v lc0 v lc2 v lc1 v ss v dd 2r r r r v lcd lcon.7 = 0: enable internal resistors s3c9234 bias lcon.0 v lc0 v lc2 v lc1 v ss v dd 2r r r r v lcd lcon.7 = 0: enable internal resistors static and 1/3 bias (v lcd = 5v at v dd = 5v) voltage dividing resistor adjustment s3c9234 bias lcon.0 v lc0 v lc2 v lc1 v ss v dd r'' r' r' r' v lcd lcon.7 = 1: disable internal resistors figure 13-5. internal voltage dividing resistor connection
lcd controller/driver s3c9234/p9234 13- 6 common (com) signals the common signal output pin selection (com pin selection) varies according to the selected duty cycle. ? in 1/4 duty mode, com0-com3 pins are selected ? in 1/3 duty mode, com0-com2 pins are selected ? in 1/2 duty mode, com0-com1 pins are selected segment (seg) signals the 31 lcd segment signal pins are connected to corresponding display ram locations at page 0. bits of the display ram are synchronized with the common signal output pins. when the bit value of a display ram location is "1", a select signal is sent to the corresponding segment pin. when the display bit is "0", a 'no-select' signal to the corresponding segment pin. 1 frame select non-select fr com seg com-seg v lc0 v ss v lc0 v ss v lc0 v ss -v lc0 figure 13-6. select/ n o- s elect s ignals in static d isplay m ode
s3c9234/p9234 lcd controller/driv er 13- 7 fr select non-select 1 frame com v ss seg v ss com-seg v ss v lc1, 2 v lc 0 -v lc 0 -v lc1, 2 v lc1, 2 v lc 0 v lc1, 2 v lc 0 figure 13-7. select/no-select signal in 1/2 duty, 1/2 bias display mode fr select non-select 1 frame seg com com-seg v lc0 v ss v lc1 v lc2 v lc0 v ss v lc1 v lc2 v lc0 v ss v lc1 v lc2 -v lc0 -v lc1 -v lc2 figure 13-8. select/no-select signal in 1/3 duty, 1/3 bias display mode
lcd controller/driver s3c9234/p9234 13- 8 fr 1 frame com0 com1 seg0 seg1 com0 -seg0 com0 -seg1 com1 -seg0 com1 -seg1 0 1 0 1 note: v lc2 = v lc1 seg1 seg2 seg3 seg0 seg3.1 x c1 .0 .1 .2 .3 1 0 x x 1 1 x x .4 .5 .6 .7 0 1 x x .0 .1 .2 .3 1 0 x x .4 .5 .6 .7 data register page 4, address b0h ld b0h, #31h data register page 4, address b1h ld b1h, #12h com0 com1 seg2.1 x c1 seg0.0 x c0 seg0.1 x c1 seg1.0 x c0 seg3.0 x c0 seg2.1 x c1 seg2.0 x c0 seg2.0 x c0 seg1.1 x c1 v ss v ss v ss v ss -v lc1, 2 v ss -v lc0 v ss v ss v ss v lc1, 2 v lc0 v lc1, 2 v lc0 v lc1, 2 v lc0 v lc1, 2 v lc0 v lc1, 2 v lc0 v lc1, 2 v lc0 -v lc1, 2 -v lc0 v lc1, 2 v lc0 -v lc1, 2 -v lc0 v lc1, 2 v lc0 -v lc1, 2 -v lc0 figure 13-9. lcd signal and wave forms example in 1/2 duty, 1/2 bias display mode
s3c9234/p9234 lcd controller/driv er 13- 9 com0 com1 seg0 seg1 com0 -seg0 com0 -seg1 com1 -seg0 com1 -seg1 com2 v ss v ss v ss v ss v ss fr 1 frame 0 1 2 0 1 2 seg1.6 x c2 seg2.1 x c1 seg2.0 x c0 seg0.0 x c0 seg2.1 x c1 seg1.4 x c0 seg0.2 x c2 seg2.0 x c0 seg1.5 x c1 seg0.1 x c1 com0 com1 seg0 data register page 4, address b0h ld b0h, #16h seg1 1 0 0 x .4 .5 .6 .7 seg2 1 1 0 x .0 .1 .2 .3 com2 v ss v ss v ss v ss .0 .1 .2 .3 0 1 1 x seg3 seg4 1 1 0 x .0 .1 .2 .3 data register page 4, address b2h ld b2h, #33h seg5 1 1 0 x .4 .5 .6 .7 data register page 4, address b1h ld b1h, #43h .4 .5 .6 .7 0 0 1 x v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 figure 13-10. lcd signals and wave forms example in 1/3 duty, 1/3 bias display mode
lcd controller/driver s3c9234/p9234 13- 10 1 frame 0 1 2 3 1 2 v ss v ss com0 com1 com3 seg0 com0 -seg0 com0 -seg1 com1 -seg1 com2 fr 0 3 v ss v ss v ss v ss v ss v ss v ss v ss seg1 com1 -seg0 seg1.7 x c3 seg2.1 x c1 seg1.4 x c0 seg0.0 x c0 seg0.1 x c1 seg1.5 x c1 seg0.3 x c3 seg2.0 x c0 seg1.6 x c2 seg0.2 x c2 com0 com1 com2 data register page 4, address b1h ld b1h, #7ah seg2 0 1 0 1 .0 .1 .2 .3 seg3 1 1 1 0 .4 .5 .6 .7 data register page 4, address b2h ld b2h, #63h seg4 1 1 0 0 .0 .1 .2 .3 seg5 0 1 1 0 .4 .5 .6 .7 com3 data register page 4, address b0h ld b0h, #3eh seg0 0 1 1 1 .0 .1 .2 .3 seg1 1 1 0 0 .4 .5 .6 .7 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 v lc2 v lc1 v lc0 -v lc1 -v lc0 -v lc2 figure 13-11. lcd signals and wave forms example in 1/4 duty, 1/3 bias display mode
s3c9234/p9234 serial i/o interface 14- 1 1 4 serial i/o interfac e overview serial i/o modules, sio can interface with various types of external device that require serial data transfer. the components of sio function block are: ? 8-bit control register (s iocon ) ? clock selector logic ? 8-bit data buffer (siodata) ? 8-bit prescaler (siops) ? 3-bit serial clock counter ? serial data i/o pins (si, so) ? serial clock input/output pin (sck) the sio module can transmit or receive 8-bit serial data at a frequency determined by its corresponding control register settings. to ensure flexible data transmission rates, you can select an internal or external clock source. programming procedure to program the sio module, follow these basic steps: 1. configure the i/o pins at port (sck/si/so) by loading the appropriate value to the p2con register if necessary. 2. load an 8-bit value to the siocon control register to properly configure the serial i/o module. in this operation, siocon.2 must be set to "1" to enable the data shifter. 3. for interrupt generation, set the serial i/o interrupt enable bit (siocon) to "1". 4. when you transmit data to the serial buffer, write data to siodata and set siocon.3 to 1, the shift operation starts. 5. when the shift operation (transmit/receive) is completed, the sio pending bit (siocon.0) are set to "1" and sio interrupt request is generated.
serial i/o interface s3c9234/p9234 14- 2 sio control registers (siocon) the control register for serial i/o interface module, siocon, is located at d0h in page 0. it has the control setting for sio module. ? clock source selection (internal or external) for shift clock ? interrupt enable ? edge selection for shift operation ? clear 3-bit counter and start shift operation ? shift operation (transmit) enable ? mode selection (transmit/receive or receive-only) ? data direction selection (msb first or lsb first) a reset clears the siocon value to "00h". this configures the corresponding module with an internal clock source at the sck, selects receive-only operating mode, and clears the 3-bit counter. the data shift operation and the interrupt are disabled. the selected data direction is msb-first. serial i/o module control register (siocon) d0h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb sio interrupt enable bit: 0 = disable sio interrupt 1 = enable sio interrupt sio interrupt pending bit: 0 = no interrupt pending (when read) clear pending bit (when write) 1 = interrupt is pending sio shift operation enable bit: 0 = disable shifter and clock counter 1 = enable shifter and clock counter shift clock edge selection bit: 0 = t x at falling edeges, rx at rising edges. 1 = t x at rising edeges, rx at falling edges. data direction control bit: 0 = msb-first mode 1 = lsb-first mode sio mode selection bit: 0 = receive only mode 1 = transmit/receive mode sio counter clear and shift start bit: 0 = no action 1 = clear 3-bit counter and start shifting sio shift clock selection bit: 0 = internal clock (p.s clock) 1 = external clock (sck) figure 14- 1. serial i/o module control register (siocon)
s3c9234/p9234 serial i/o interface 14- 3 sio pre-scaler register (siops) the prescaler register for serial i/o interface module, siops, are located at d2h in page 0. the value stored in the sio pre-scaler register, siops, lets you determine the sio clock rate (baud rate) as follows: baud rate = input clock (fxx/4)/(prescaler value + 1), or sck input clock. sio pre-scaler register (siops) d2h, page 0, r/w .7 .6 .5 .4 .3 .2 .1 .0 msb lsb baud rate = (f xx /4)/(siops + 1) figure 14-2. sio prescaler register (siops) sio block diagram sio int pending 3-bit counter clear siocon.0 fxx /2 siops (d2h, page 0) sck siocon.7 siocon.1 (interrupt enable) clk si siocon.3 data bus so m u x 1/2 8-bit p.s. 8 8-bit sio shift buffer (siodata, d1h, page 0) clk siocon.4 (edge select) siocon.5 (mode select) siocon.2 (shift enable) siocon.6 (lsb/msb first mode select) figure 14-3. sio functional block diagram
serial i/o interface s3c9234/p9234 14- 4 serial i/o timing diagram (sio) so transmit complete sio int set siocon.3 do7 do6 do5 do4 do3 do2 do1 do0 di7 di6 di5 di4 di3 di2 di1 di0 si sck figure 14-4 . serial i/o timing in transmit/receive mode (tx at falling, siocon.4 = 0) sio int do7 do6 do5 do4 do3 do2 do1 do0 di7 di6 di5 di4 di3 di2 di1 di0 sck transmit complete si so set siocon.3 figure 14-5 . serial i/o timing in transmit/receive mode (tx at rising, siocon.4 = 1)
s3c9234/p9234 elect rical data 15- 1 15 electrical data overview in this chapter, s3c9234/p9234 electrical characteristics are presented in tables and graphs. the information is arranged in the following order: ? absolute maximum ratings ? d.c. electrical characteristics ? data retention supp ly voltage in stop mode ? stop mode release timing when initiated by an external interrupt ? stop mode release timing when initiated by a reset ? i/o capacitance ? a.c. electrical characteristics ? input timing for external interrupts ? input timing for reset ? serial data transfer timing ? oscillation characteristics ? oscillation stabilization time ? operating voltage range
electrical data s3c 9234/p9234 15- 2 table 15-1. absolute maximum ratings (t a = 25 c) parameter symbol conditions rating unit supply voltage v dd ? ? 0.3 to + 6.5 v input voltage v i ports 0 ?6 ? 0.3 to v dd + 0.3 v output voltage v o ? ? 0.3 to v dd + 0.3 v output current high i oh one i/o pin active ? 15 ma all i/o pins active ? 60 output current low i ol one i/o pin active + 30 ma total pin current for ports + 100 operating temperature t a ? ? 25 to + 85 c storage temperature t stg ? ? 65 to + 150 c table 15-2. d.c. electrical characteristics (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) parameter symbol conditions min typ max unit operating voltage v dd fx = 0 ? 4.2mhz, fxt = 32.8khz 2.0 ? 5.5 v fx = 0 ? 8.0mhz 2.7 ? 5.5 input high v ih1 all input pins except for v ih2 , v ih3 0.7 v dd ? v dd v voltage v ih2 ports 1-2, reset 0.8 v dd v dd v ih3 x in , x out and xt in , xt out v dd ? 0.1 v dd input low voltage v il1 all input pins except for v il2 , v il3 ? ? 0.3 v dd v v il2 ports 1-2, reset 0.2 v dd v il3 x in , x out , xt in , xt out 0.1 output high voltage v oh v dd = 4.5 to 5.5 v; all output ports; i oh = ?1 ma v dd ? 1.0 ? ? v output low voltage v ol1 v dd = 4.5 to 5.5 v i ol = 15ma ports 1-2 ? ? 2.0 v v ol2 v dd = 4.5 to 5.5 v i ol = 10ma all output ports except for v ol1 ? ? 2.0 v input high leakage current i lih1 v i = v dd all input pins except for i lih2 ? ? 3 m a i lih2 v i = v dd x in , x out , xt in , xt out 20
s3c9234/p9234 elect rical data 15- 3 table 15-2. d.c. electrical characteristics (continued) (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) parameter symbol conditions min typ max unit input low leakage current i lil1 v i = 0 v; all input pins except reset , i lil2 ? ? ?3 m a i lil2 v i = 0 v; x in , x out , xt in , xt out ?20 output high leakage current i loh v o = v dd all output pins ? ? 3 output low leakage current i lol v o = 0 v all output pins ? ? ?3 pull-up resistor r l1 v i = 0 v; v dd = 5v, t a = 25 c ports 0?6 25 50 100 k w v dd = 3v, t a = 25 c 50 100 150 r l2 v i = 0 v; v dd = 5v, t a = 25 c reset 150 250 400 v dd = 3v, t a = 25 c 300 500 700 oscillator feed back resistors r osc1 v dd = 5 v, t a = 25 c x in = v dd , x out = 0v 300 600 1500 k w r osc2 v dd = 5 v, t a = 25 c xt in = v dd , xt out = 0 v 1500 3000 4500 lcd voltage dividing resistor r lcd t a = 25 c 100 150 200 k w ? v lcd -comi ? voltage drop (i = 0-3) v dc - 15 m a per common pin ? ? 120 mv ? v lcd - seg x ? voltage drop (x = 0?31) v ds - 15 m a per common pin ? ? 120 middle output voltage (1) v lc0 v dd = 2.7 v to 5.5 v, 1/3 bias lcd clock = 0hz, v lc1 = v dd 0.6v dd ?0.2 0.6v dd 0.6v dd + 0.2 v v lc1 0.4v dd ?0.2 0.4v dd 0.4v dd + 0.2 v lc2 0.2v dd ?0.2 0.2v dd 0.2v dd + 0.2 note: it is middle output voltage when the bias pin and the v lc0 pin are opened.
electrical data s3c 9234/p9234 15- 4 table 15-2. d.c. electrical characteristics (concluded) (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) parameter symbol conditions min typ max unit supply current (1) i dd1 (2) run mode: v dd = 5 v 10% 8.0 mhz ? 6.0 12.0 ma crystal oscillator c1 = c2 = 22pf 4.0 mhz 2.6 5.2 v dd = 3 v 10% 8.0 mhz 2.5 5.0 4.0 mhz 1.2 2.4 i dd2 (2) idle mode: v dd = 5 v 10% 8.0 mhz 1.3 3.0 crystal oscillator c1 = c2 = 22pf 4.0 mhz 0.9 1.8 v dd = 3 v 10% 8.0 mhz 0.8 1.6 4.0 mhz 0.4 0.8 i dd3 (3) run mode: v dd = 3 v 10%, 32 khz crystal oscillator 15.0 30.0 m a i dd4 (3) idle mode: v dd = 3 v 10%, 32 khz crystal oscillator 6.0 15.0 i dd5 (4) stop mode; v dd = 5 v 10%, t a = 25 c 0.5 3.0 stop mode; v dd = 3 v 10%, t a = 25 c 0.3 2.0 notes: 1. supply current does not include current drawn through internal pull-up resistors, lcd voltage dividing resistors, and external output current loads. 2. i dd1 and i dd2 include power consumption for subsystem clock oscillation. 3. i dd3 and i dd4 are current when main system clock oscillation stops and the subsystem clock is used. 4. i dd5 is current when main system clock and subsystem clock oscillation stops. 5. every values in this table is measured when bits 4-3 of the system clock control register (clkcon.4-.3) is set to 11b.
s3c9234/p9234 elect rical data 15- 5 table 15-3. data retention supply voltage in stop mode (t a = ? 25 c to + 85 c) parameter symbol conditions min typ max unit data retention supply voltage v dddr ? 2.0 ? 5.5 v data retention supply current i dddr stop mode, t a = 25 c v dddr = 2.0 v ? ? 1 m a execution of stop instruction idle mode (basic timer active) ~ ~ v dddr ~ ~ stop mode normal operating mode data retention mode v dd 0.8 v dd t wait note: t wait is the same as 16 x 1/bt clock. figure 15-1. stop mode release timing when initiated by an external interrupt
electrical data s3c 9234/p9234 15- 6 execution of stop instrction reset occurs ~ ~ v dddr ~ ~ stop mode oscillation stabilization time normal operating mode data retention mode t wait reset v dd 0.2 v dd 0.8 v dd note: t wait is the same as 16 1/bt clock. figure 15-2. stop mode release timing when initiated by a reset table 15-4. input/output capacitance (t a = 25 c, v dd = 0 v) parameter symbol conditions min typ max unit input capacitance c in f = 1 mhz; unmeasured pins are connected to v ss ? ? 10 pf output capacitance c out i/o capacitance c io
s3c9234/p9234 elect rical data 15- 7 table 15-5. a.c. electrical characteristics (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) parameter symbol conditions min typ max unit sck cycle time t kcy external sck source 1,000 ? ? ns internal sck source 1,000 sck high, low width t kh , t kl external sck source 500 internal sck source t kcy /2?50 si setup time to sck high t sik external sck source 250 internal sck source 250 si hold time to sck high t ksi external sck source 400 internal sck source 400 output delay for sck to so t kso external sck source ? ? 300 ns internal sck source 250 interrupt input, high, low width t inth , t intl all interrupt v dd = 3 v 500 700 ? ns reset input low width t rsl input v dd = 3 v 10 ? ? m s t inth t intl 0.8 v dd 0.2 v dd note: the unit t cpu means one cpu clock period. external interrupt figure 15-3. input timing for external interrupts
electrical data s3c 9234/p9234 15- 8 reset t rsl 0.2 v dd figure 15-4. input timing for reset t kh t kl 0.2v dd sck t kcy 0.8v dd 0.8v dd 0.2v dd t sik t ksi si so t kso output data figure 15-5. serial data transfer timing
s3c9234/p9234 elect rical data 15- 9 table 15-6. main oscillation characteristics (t a = ? 25 c to + 85 c) oscillator clock configuration parameter test condition min typ max units crystal x in c1 x out main oscillation frequency 2.7 v ? 5.5 v 0.4 ? 8 mhz 2.0 v ? 5.5 v 0.4 ? 4.2 ceramic oscillator x in c1 x out main oscillation frequency 2.7 v ? 5.5 v 0.4 ? 8 2.0 v ? 5.5 v 0.4 ? 4.2 external clock x in x out x in input frequency 2.7 v ? 5.5 v 0.4 ? 8 2.0 v ? 5.5 v 0.4 ? 4.2 rc oscillator x in x out r frequency 5.0 v 0.4 ? 2 mhz frequency 3.0 v 0.4 ? 1 table 15-7. sub oscillation characteristics (t a = ? 25 c to + 85 c) oscillator clock configuration parameter test condition min typ max units crystal x in c1 x out sub oscillation frequency 2.0 v ? 5.5 v 32 32.768 35 khz external clock x in x out xt in input frequency 2.0 v ? 5.5 v 32 ? 100
electrical data s3c 9234/p9234 15- 10 table 15-8. main oscillation stabilization time (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) oscillator test condition min typ max unit crystal fx > 1 mhz ? ? 30 ms ceramic oscillation stabilization occurs when vdd is equal to the minimum oscillator voltage range. ? ? 10 ms external clock x in input high and low width (t xh , t xl ) 62.5 ? 1250 ns t x t xl v dd -0.1 v 0.1 v x in 1/fx figure 15-6. clock timing measurement at x in
s3c9234/p9234 elect rical data 15- 11 table 15-9. sub oscillation stabilization time (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) oscillator test condition min typ max unit crystal ? ? ? 10 s external clock xt in input high and low width (t xh , t xl ) 5 ? 15 m s t xth t xtl v dd -0.1 v 0.1 v xt in 1/fxt figure 15-7. clock timing measurement at xt in
electrical data s3c 9234/p9234 15- 12 2 mhz 6.25 khz (main)/8.2 khz(sub) 1 2 6 supply voltage (v) instruction clock = 1/4n x oscillator frequency (n = 1, 2, 8, 16) 1.0 mhz instruction clock 8 mhz 4 mhz fx (main/sub oscillation frequency) 400 khz 2.7 5.5 400 khz (main)/32.8 khz(sub) figure 15-8. operating voltage range
s3c9234/p9234 mechanical data 16- 1 16 mechanical data overview the s3c9234/p9234 microcontroller is currently available in a 64-qfp-1420f package. 64-qfp-1420f #64 20.00 0.20 23.90 0.30 14.00 0.20 17.90 0.30 #1 1.00 (1.00) 0.40 + 0.10 - 0.05 note : dimensions are in millimeters. 0.80 + 0.20 0.10 max 0.15 + 0.10 - 0.05 0-8 0.80 0.20 0.05 min 2.65 0.10 3.00 max 0.15 max figure 16-1. 64-pin qfp package dimensions (64-qfp-1420f)
mechanical data s3c9234/p9234 16- 2 notes
s3c9234/p9234 S3P9234 otp 17- 1 17 S3P9234 otp overview the S3P9234 single-chip cmos microcontroller is the otp (one time programmable) version of the s3c9234 microcontroller. it has an on-chip otp rom instead of masked rom. the eprom is accessed by serial data format. the S3P9234 is fully compatible with the s3c9234, both in function and in pin configuration. because of its simple programming requirements, the S3P9234 is ideal for use as an evaluation chip for the s3c9234.
S3P9234 otp s3c9234/p9234 17- 2 S3P9234 (64-qfp-1420f) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 64 63 62 61 60 59 58 57 56 55 54 53 52 20 21 22 23 24 25 26 27 28 29 30 31 32 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 seg13/p5.2 seg14/p5.1 seg15/p5.0 seg16/p4.7 seg17/p4.6 seg18/p4.5 seg19/p4.4 seg20/p4.3 seg21/p4.2 seg22/p4.1 seg23/p4.0 seg24/p3.7 seg25/p3.6 seg26/p3.5 seg27/p3.4 seg28/p3.3 seg29/p3.2 seg30/p3.1 seg31/p3.0 com0/p0.0 com1/p0.1 com2/p0.2 com3/p0.3 bias vlc0 sdat /vlc1 sclk /vlc2 v dd /v dd v ss /v ss x out x in v pp /test xt in xt out reset /reset p1.0/int p1.1/int p1.2/int seg0/p6.7 seg1/p6.6 seg2/p6.5 seg3/p6.4 seg4/p6.3 seg5/p6.2 seg6/p6.1 seg7/p6.0 seg8/p5.7 seg9/p5.6 seg10/p5.5 seg11/p5.4 seg12/p5.3 p1.3/t1clk p1.4/taout p1.5/tbout p1.6/clkout p1.7/buz p2.0/sck p2.1/so p2.2/si p2.3 p2.4/int p2.5/int p2.6/int p2.7/int figure 17-1. S3P9234 pin assignments (64-qfp-1420f)
s3c9234/p9234 S3P9234 otp 17- 3 table 17-1. descriptions of pins used to read/write the eprom main chip during programming pin name pin name pin no. i/o function vlc1 sdat 7 i/o serial data pin. output port when reading and input port when writing. can be assigned as a input/push-pull output port. vlc2 sclk 8 i/o serial clock pin. input only pin. test v pp (test) 13 i power supply pin for eprom cell writing (indicates that otp enters into the writing mode). when 12.5 v is applied, otp is in writing mode and when 5 v is applied, otp is in reading mode. (option) reset reset 16 i chip initialization v dd /v ss v dd /v ss 9 / 10 i logic power supply pin. v dd should be tied to + 5 v during programming. note : parentheses indicate pin number for 64-pin-qfp-1420f package. table 17-2. comparison of S3P9234 and s3c9234 features characteristic S3P9234 s3c9234 program memory 4 kbyte eprom 4 kbyte mask rom operating voltage (v dd ) 2.0 v to 5.5 v 2.0 v to 5.5 v otp programming mode v dd = 5 v, v pp (test)=12.5v pin configuration 64-qfp 64-qfp eprom programmability user program 1 time programmed at the factory operating mode characteristics when 12.5 v is supplied to the v pp (test) pin of the s3p72c8, the eprom programming mode is entered. the operating mode (read, write, or read protection) is selected according to the input signals to the pins listed in table 17-3 below. table 17-3. operating mode selection criteria v dd v pp (test) reg/ mem address (a15-a0) r/w mode 5 v 5 v 0 0000h 1 eprom read 12.5 v 0 0000h 0 eprom program 12.5 v 0 0000h 1 eprom verify 12.5 v 1 0e3fh 0 eprom read protection note : "0" means low level; "1" means high level.
S3P9234 otp s3c9234/p9234 17- 4 table 17-4. d.c. electrical characteristics (t a = ? 25 c to + 85 c, v dd = 2.0 v to 5.5 v) parameter symbol conditions min typ max unit supply current (1) i dd1 run mode: v dd = 5 v 10% 8.0 mhz ? 6.0 12.0 ma crystal oscillator c1 = c2 = 22pf 4.0 mhz 2.6 5.2 v dd = 3 v 10% 8.0 mhz 2.5 5.0 4.0 mhz 1.2 2.4 i dd2 idle mode: v dd = 5 v 10% 8.0 mhz 1.3 3.0 crystal oscillator c1 = c2 = 22pf 4.0 mhz 0.9 1.8 v dd = 3 v 10% 8.0 mhz 0.8 1.6 4.0 mhz 0.4 0.8 i dd3 run mode: v dd = 3 v 10%, 32 khz crystal oscillator 15.0 30.0 m a i dd4 idle mode: v dd = 3 v 10%, 32 khz crystal oscillator 6.0 15.0 i dd5 stop mode; v dd = 5 v 10%, t a = 25 c 0.5 3.0 stop mode; v dd = 3 v 10%, t a = 25 c 0.3 2.0 notes: 1. supply current does not include current drawn through interna l pull-up resistors, lcd voltage dividing resistors, and external output current loads. 2. i dd1 and i dd2 include power consumption for subsystem clock oscillation. 3. i dd3 and i dd4 are current when main system clock oscillation stops and the subsystem clock is used. 4. i dd5 is current when main system clock and subsystem clock oscillation stops. 5. every values in this table is measured when bits 4-3 of the system clock control register (clkcon.4-.3) is set to 11b.
s3c9234/p9234 S3P9234 otp 17- 5 2 mhz 6.25 khz (main)/8.2 khz(sub) 1 2 6 supply voltage (v) instruction clock = 1/4n x oscillator frequency (n = 1, 2, 8, 16) 1.0 mhz instruction clock 8 mhz 4 mhz fx (main/sub oscillation frequency) 400 khz 2.7 5.5 400 khz (main)/32.8 khz(sub) figure 17-2. standard operating voltage range
S3P9234 otp s3c9234/p9234 17- 6 notes
s3c9234/p9234 devel opment tools 18- 1 18 development tools overview samsung provides a powerful and easy-to-use development support system in turn key form. the development support system is configured with a host system, debugging tools, and support software. for the host system, any standard computer that operates with ms-dos as its operating system can be used. one type of debugging tool including hardware and software is provided: the sophisticated and powerful in-circuit emulator, smds2+, for s3c7, s3c8, s3c9 families of microcontrollers. the smds2+ is a new and improved version of smds2. samsung also offers support software that includes debugger, assembler, and a program for setting options. shine samsung host interface for in-circuit emulator, shine, is a multi-window based debugger for smds2+. shine provides pull-down and pop-up menus, mouse support, function/hot keys, and context-sensitive hyper-linked help. it has an advanced, multiple-windowed user interface that emphasizes ease of use. each window can be sized, moved, scrolled, highlighted, added, or removed completely. sama assembler the samsung arrangeable microcontroller (sam) assembler, sama, is a universal assembler, and generates object code in standard hexadecimal format. assembled program code includes the object code that is used for rom data and required smds program control data. to assemble programs, sama requires a source file and an auxiliary definition (def) file with device specific information. sasm86 the sasm86 is an relocatable assembler for samsung's s3c9-series microcontrollers. the sasm86 takes a source file containing assembly language statements and translates into a corresponding source code, object code and comments. the sasm86 supports macros and conditional assembly. it runs on the ms-dos operating system. it produces the relocatable object code only, so the user should link object file. object files can be linked with other object files and loaded into memory. hex2rom hex2rom file generates rom code from hex file which has been produced by assembler. rom code must be needed to fabricate a microcontroller which has a mask rom. when generating the rom code (.obj file) by hex2rom, the value ?ff? is filled into the unused rom area up to the maximum rom size of the target device automatically. target boards target boards are available for all s3c9-series microcontrollers. all required target system cables and adapters are included with the device-specific target board.
development tools s3c9234/p9234 18- 2 bus smds2+ rs-232c pod probe adapter prom/otp writer unit ram break/display unit trace/timer unit sam8 base unit power supply unit ibm-pc at or compatible tb9234 target board eva chip target application system figure 18-1. smds product configuration (smds2+)
s3c9234/p9234 devel opment tools 18- 3 tb9234 target board the tb9234 target board is used for the s3c9234 microcontroller. it is supported by the smds2+ development system. tb9234 gnd v cc to user_v cc off on smds2 smds2+ j101 64qfp j102 64qfp 1 9 29 39 19 2 30 40 20 10 25 160 30 20 10 1 150 140 130 50 60 70 80 90 100 110 120 reset r1 d1 c1 7411 b1 r7 r8 y1 cb + c15 c16 idle + stop + r5 r4 b2 20 10 1 51 76 26 rev.0 '2003. 05. 28 cn1 u2 u3 c7 c12 1 3 4 6 jp6 40 b3 c14 r9 c11 r10 1 9 29 39 19 2 30 40 20 10 figure 18-2. tb9234 target board configuration
development tools s3c9234/p9234 18- 4 table 18-1. power selection settings for tb9234 "to user_v cc " settings operating mode comments to user_v cc off on target system smds2/smds2+ tb9234 v cc v ss v cc the smds2/smds2+ supplies v cc to the target board (evaluation chip) and the target system. to user_v cc off on target system smds2/smds2+ tb9234 external v cc v ss v cc the smds2/smds2+ supplies v cc only to the target board (evaluation chip). the target system must have its own power supply. note : the following symbol in the "to user_v cc " setting column indicates the electrical short (off) configuration:
s3c9234/p9234 devel opment tools 18- 5 smds2+ selection (sam8) in order to write data into program memory that is available in smds2+, the target board should be selected to be for smds2+ through a switch as follows. otherwise, the program memory writing function is not available. table 18-2. the smds2+ tool selection setting "sw1" setting operating mode smds2 smds2+ target board r/w r/w smds2+ table 18-3. using single header pins as the input path for external trigger sources target board part comments external triggers ch1 ch2 connector from external trigger sources of the application system you can connect an external trigger source to one of the two external trigger channels (ch1 or ch2) for the smds2+ breakpoint and trace functions. idle led the green led is on when the evaluation chip (s3e9230) is in idle mode. stop led the red led is on when the evaluation chip (s3e9230) is in stop mode.
development tools s3c9234/p9234 18- 6 seg31/p3.0 seg29/p3.2 seg27/p3.4 seg25/p3.6 seg23/p4.0 seg21/p4.2 seg19/p4.4 seg17/p4.6 seg15/p5.0 seg13/p5.2 seg11/p5.4 seg9/p5.6 seg7/p6.0 seg5/p6.2 seg3/p6.4 seg1/p6.6 n.c n.c n.c n.c com1/p0.1 com3/p0.3 vlc0 vlc2 g nd x in xt in reset p1.1/int p1.3/t1clk p1.5/tbout p1.7/buz p2.1/so p2.3 p2.5/int p2.7/int n.c n.c n.c n.c j101 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 j102 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 com0/p0.0 com2/p0.2 bias vlc1 v dd x out test xt out p1.0/int p1.2/int p1.4/taout p1.6/clkout p2.0/sck p2.2/si p2.4/int p2.6/int n.c n.c n.c n.c seg30/p3.1 seg28/p3.3 seg26/p3.5 seg24/p3.7 seg23/p4.1 seg20/p4.3 seg18/p4.5 seg16/p4.7 seg14/p5.1 seg12/p5.3 seg10/p5.5 seg8/p5.7 seg6/p6.1 seg4/p6.3 seg2/p6.5 seg0/p6.7 n.c n.c n.c n.c figure 18-3. connectors (j101, j102) for tb9234 target board 40-pin connector target cable for 40-pin connector part name: as40d-a order code: sm6306 j102 33 34 63 64 j101 1 2 31 32 target board 40-pin connector j102 j101 1 2 33 34 63 64 31 32 figure 18-4. s3c9234 probe adapter for 64-qfp package
(for duplicate copies of this form, and for additional ordering information, please contact your local sa m sung sales representative. samsung sales offices are listed on the back cover of this book.) s3c9 series mask rom order form product description: device number: s3c9__________- ___________(write down the rom code number) product order form: package pellet wafer package type: __________ package marking (check one): standard custom a custom b (max 10 chars) (max 10 chars each line) @ : assembly site code, y : last number of assembly year, ww : week of assembly @ yww device name sec device name @ yww @ yww delivery dates and quantities: deliverable required delivery date quantity comments rom code ? not applicable see rom selection form customer sample risk order see risk order sheet please answer the following questions: f for what kind of product will you be using this order? new product upgrade of an existing product replacement of an existing product other if you are replacing an existing product, please indicate the former product name ( ) f what are the main reasons you decided to use a samsung microcontroller in your product? please check all that apply. price product quality features and functions development system technical support delivery on time used same micom before quality of documentation samsung reputation mask charge (us$ / won): ____________________________ customer information: company name: ___________________ telephone number _________________________ signatures: ________________________ __________________________________ (person placing the order) (technical manager)

(for duplicate copies of this form, and for additional ordering information, please contact your local sa m sung sales representative. samsung sales offices are listed on the back cover of this book.) s3c9 series request for production at customer risk customer information: company name: _____________________________ ___________________________________ department: ________________________________________________________________ telephone number: __________________________ fax: _____________________________ date: __________________________ risk order information: device number: s3c9________- ________ (write down the rom code number) package: number of pins: ____________ package type: _____________________ intended application: ________________________________________________________________ product model number: _____ ___________________________________________________________ customer risk order agreement: we hereby request sec to produce the above named product in the quantity stated below. we believe our risk order product to be in full compliance with all sec production specifications and, to this extent, agree to assume responsibility for any and all production risks involved. order quantity and delivery schedule: risk order quantity: _____________________ pcs delivery schedule: delivery date (s) quantity comments signatures: _______________________________ _________________________________ _____ _ (person placing the risk order) (sec sales representative)

(for duplicate copies of this form, and for additional ordering information, please contact your local sa m sung sales representative. samsung sales offices are listed on the back cover of this book.) s3c9234 mask option selection form device number: s3c9234-__________(write down the rom code number) attachment (check one): diskette prom customer checksum: ________________________________________________________________ company name: ________________________________________________________________ signature (engineer): ________________________________________________________________ please answer the following questions: f application ( product model id: _______________________) audio video telecom lcd databank caller id lcd game industrials home appliance office a utomation remocon other please describe in detail its application __________________________________________________________________________ _
(for duplicate copies of this form, and for additional ordering information, please contact your local sa m sung sales representative. samsung sales offices are listed on the back cover of this book.) s3p9 series otp factory writing order form (1/2) product d escription: device number: s3 p 9________-________(write down the rom code number) product order form: package pellet w afer if the product order form is package: package type: _____________________ package marking (check one): standard custom a custom b (max 10 chars) (m ax 10 chars each line) @ : assembly site code, y : last number of assembly year, ww : week of assembly @ yww device name sec device name @ yww @ yww delivery dates and quantity: rom code release date required delivery date of device quantity please answer the following questions: f what is the purpose of this order ? new product development upgrade of an existing product replacement of an existing microcontroller other if you are replacing an existing microcontroller , please indicate the former microcontroller name ( ) f what are th e main reasons you decided to use a samsung microcontroller in your product? please check all that apply. price product quality features and functions development system technical support delivery on time used same micom before quality of documentation samsung reputation customer information: company name: ___________________ telephone number ______________ ___________ signatures: ________________________ __________________________________ (person placing the order) (technical manager)
(for duplicate copies of this form, and for additional ordering information, please contact your local sa m sung sales representative. samsung sales offices are listed on the back cover of this book.) S3P9234 otp factory writing order form (2/2) device number: S3P9234 - __________(write down the rom code number) customer checksums: _________ ____________________________ _________________________ _ company name: ________________________________________________________________ signature (engineer): ________________________________________________________________ read protection (1) : yes no please answer the following questions: f are you going to continue ordering this device? yes no if so, how much will you be ordering? _________________pcs f application ( product model id: _______________________) audio video telecom lcd databank caller id lcd game industrials home appliance office a utomation remocon other please describe in detail its application __________________________________________________________________________ notes 1. once you choose a read protection, you cannot read again the programming code from the eprom. 2. otp writing will be executed in our manufacturing site. 3. the writing program is completely verified by a customer. samsung does not take on any responsibility for err ors occurred from the writing program.


▲Up To Search▲   

 
Price & Availability of S3P9234

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X